Last-child Not Working Css/html
I'm trying to have a row of four divs. As you can see im trying to get that last div a 0px margin using last-child. But i can’t seem to get rid of the margin.
Solution 1:
You have to move selector to .frontpage
.
.frontpage:last-child {
margin-right: 0;
}
Solution 2:
adding the missing closing div to each solved the problem
.frontpage {
width: 240px;
margin-bottom: 20px;
margin-right: 50px;
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.frontpageimg {
margin: 10px auto;
}
.frontpagea:last-childimg {
margin-right: 0;
}
<divclass="frontpage">RETRO
<br><ahref="retro/index.html"><imgsrc="images/name1.jpg"alt=""></a><p>TEXT</p><divclass="readmore"><ahref="retro/index.html">READ MORE</a></div></div><divclass="frontpage">RETRO
<br><ahref="retro/index.html"><imgsrc="images/name1.jpg"alt=""></a><p>TEXT</p><divclass="readmore"><ahref="retro/index.html">READ MORE</a></div></div><divclass="frontpage">RETRO
<br><ahref="retro/index.html"><imgsrc="images/name1.jpg"alt=""></a><p>TEXT</p><divclass="readmore"><ahref="retro/index.html">READ MORE</a></div></div><divclass="frontpage">RETRO
<br><ahref="retro/index.html"><imgsrc="images/name1.jpg"alt=""></a><p>TEXT</p><divclass="readmore"><ahref="retro/index.html">READ MORE</a></div></div>
Post a Comment for "Last-child Not Working Css/html"