# Floating elements in HTML & CSS

**URL:** https://forum.codewithmosh.com/t/floating-elements-in-html-css/9425
**Category:** HTML/CSS
**Created:** [December 25, 2021, 1:00pm UTC](https://forum.codewithmosh.com/t/floating-elements-in-html-css/9425 "2021-12-25T13:00:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![AraAlex14](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@AraAlex14](https://forum.codewithmosh.com/u/AraAlex14)
#### Post date: [December 25, 2021, 1:00pm UTC](https://forum.codewithmosh.com/t/floating-elements-in-html-css/9425/1 "2021-12-25T13:00:24Z")

</div>

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?  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/a/a593cf9e43348de13121d39afe88ef26d4129b6d.png)

---

<div class="post-metadata">

### Author: ![Hollywood](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@Hollywood](https://forum.codewithmosh.com/u/Hollywood)
#### Post date: [December 25, 2021, 8:28pm UTC](https://forum.codewithmosh.com/t/floating-elements-in-html-css/9425/2 "2021-12-25T20:28:45Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![AraAlex14](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@AraAlex14](https://forum.codewithmosh.com/u/AraAlex14)
#### Post date: [December 27, 2021, 4:16pm UTC](https://forum.codewithmosh.com/t/floating-elements-in-html-css/9425/3 "2021-12-27T16:16:16Z")

</div>

Hollywood, your answer it s very helpful!! Thanks a lot!
