Honestly, the only appropriate use is to make the elements have the correct size in dom. Use this code, for example:
<div class="container"> <div>this div is floated left</div> <div>this div is floated left</div> </div>
Usually you need to specify the exact or minimum height for the div.container. if you applied the “after” using very simple CSS, any background that you applied to the .container would actually display (in almost every browser) correctly, with a small amount of padding.
.container:after{ content:'.'; height:0; line-height:0; display:block; float:left; visibility:hidden; }
Now try this example with a background color or image, and you will see that the div.container div always has the appropriate height (which will be the total total height of the internal content), even if the entire internal html (as in most ul / li css buttons).
I also use after on every div, which I transfer all my content to every html page. This is due to the possibility of placing all the content on this page, and I want to make sure that my content div always has the correct size / padding with the appropriate background.
source share