What is your first thought when you see this effect? Will it be the child element setting margin-right, when traversing Nth-child (3n) also set to 0, see what we can do with the above knowledge
<Style>. wrap2{Width320px;Border:dashed1px Orange;}. wrap2. inner{Overflow:hidden;margin-right:-10px;}. wrap2. item{Float:left;Width100px;Height100px;Margin10px10px10px0;Background:blue;}</Style><Divclass="WRAP2" ><Divclass="Inner" ><Divclass="Item" ></Div><Divclass="Item" ></Div><Divclass= "item" ></ div> <div Class= "item" ></div> <div class= "item" ></div> < div class= "item" > </div> </ div></DIV>
We did not set the margin for Nth-child (3n) to 0, but instead made the parent element "bigger" by negative margins.
Negative margin is not very interesting, not very understanding of the young boys learn it!
Reference
CSS layout Kinky inventions-powerful negative margins
Transfer from Samaritans
The use of negative margins in layouts