Hello folks, Have a Great Christmas ! I’m coming with a question today, about floating elements. Here, in our markup we want the article to be in the border area, witch we use “.clearfix::after” with those 3 lines of code who help us to insert the box in the border area. But I have one question about. Why we use the pseudo-element (::after)? How can it help us in that way?
Hello,
I found this description of the after pseudo element.
In CSS, ::after
creates a [pseudo-element] that is the last child of the selected element.
So in this case if you are on the “7 - Floating Elements” lesson it is placing the [pseudo-element] after the paragraph element.
To better see what is going on I changed the code to
this:
.clearfix::after {
content: “testing”;
display: block;
clear: both;
}
and then this:
.clearfix::after {
content: "testing ";
display: block;
}
Hope this helps and Merry Christmas!
1 Like
Hollywood, your answer it s very helpful!! Thanks a lot!
1 Like