Trying to align 2 images next to each other, I am floating one left and the other right with the intention of clearing the float using the ::after pseudo selector.
The surrounding text is expected to flow in between the images.
I often struggle with making the ::after selector work properly. Any tips or recommendations would be highly valued.
EDIT: Realized I forgot to include the ::after code
CSS
div#product > img:first-child {
float: left;
margin-left: 55px;
margin-bottom: 20px;
}
#product img {
float: right;
margin-right: 55px;
margin-bottom: 20px;
}
img::after {
clear:both;
}
HTML
<div id="product">
<img src="#" width="240" >
<img src="#" width="240" >
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</div>
Thank you.