Home  >  Article  >  Web Front-end  >  A brief analysis of negative margin values

A brief analysis of negative margin values

巴扎黑
巴扎黑Original
2017-08-11 13:51:522052browse

We all use margin in CSS, but setting margin to a negative number may not be easy to handle. Negative margin values ​​are not a hack, and negative margin values ​​follow the document flow; if you use negative margin values ​​to move an element upward, Then the related elements will also be displaced accordingly; negative margin values ​​are well compatible with various browsers.

1. There are two borders with different background colors. No matter which side increases in height, the other side also becomes higher.

2. Implement adaptive

The above is the detailed content of A brief analysis of negative margin values. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn