Use the pseudo object selector E: after to clear the floating effect.
Use the pseudo object selector E: after to clear the floating:
There are too many articles to talk about floating clearance, and it is almost ruined.
This is of course because floating is a technique that is not needed in the center. It is also necessary to clear floating. However, this chapter is still worth a while and I will introduce another method to clear floating, this is because it will use a rare pseudo-object selector, hoping to attract everyone's attention.
Let's take a look at a code example:
<! DOCTYPE html>
The above code is a common code for clearing floating. Although it can be used to clear floating, it is not perfect, because it will have an extra div tag, this will increase the pressure on the browser to interpret the page, and the page is not fresh enough, then we will use the pseudo object selector for transformation, the Code is as follows:
<! DOCTYPE html>
In the above Code, use the: after pseudo object selector to create a pseudo element, set the content of this pseudo element to a vertex, and set it to block-level element and clear: both achieves the floating clearance effect.
Related reading:
1. For details about how to clear float, refer to css clear float summary.
2. E: after, you can refer to Chapter E: after/E: after, the pseudo object selector of CSS.
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 15391.
For more information, see: http://www.softwhy.com/divcss/