In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the negative margins of floating elements in css. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
Float element
The effect of negative margins on float elements is also in accordance with the above, but it has its particularity, so it is very clear if we look at an example.
Negative margin of floating element
.float {overflow:hidden;width:280px;border:dashed 1px orange;}. Float .item {width:100px;height:100px;float:left;}. Float. Item:nth-child (1) {background:red;}. Float. Item:nth-child (2) {background:grey;}. Float. Item:nth-child (3) {background:blue;}
In a div with a width of 280px, the child elements of three float:left on the right, with a width of 100px, are moved to the next line because the last one does not fall.
We made a few changes to the code
.float {overflow:hidden;width:280px;border:dashed 1px orange;}. Float .item {width:100px;height:100px;float:left;}. Float. Item:nth-child (1) {background:red;}. Float. Item:nth-child (2) {background:grey;}. Float. Item:nth-child (3) {background:blue;margin-left:-20px;}
The third element adds the negative margin of-20px
At this time, it is found that the third element has been moved up and the second element, 20px, has been overwritten. The classic multi-column layout uses this principle.
The above is all the content of the article "how css uses negative margins of floating elements". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.