Home  >  Article  >  Web Front-end  >  Let’s briefly talk about the role of negative margin values

Let’s briefly talk about the role of negative margin values

高洛峰
高洛峰Original
2017-02-09 11:47:081932browse

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 negative margin values ​​are used to move an element upward, then it is relevant 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, the other side also becomes higher

Let’s briefly talk about the role of negative margin values

2. Implement adaptive

Let’s briefly talk about the role of negative margin values

More briefly talk about negative margin values For articles related to its functions, please pay attention to 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