Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is wrong with this html code?

Tags:

html

css

<div style="float: left">text1</div> 
<div style="float: right;">text2</div>
<div class="random_class">text3</div>

Here is the problem. Random_class goes to the top, on the text1 and text2. What is wrong? Thank you.

like image 864
good_evening Avatar asked Dec 09 '25 01:12

good_evening


1 Answers

You need to clear the floats, below is an example of it.

<div class="random_class" style="clear:both">text3</div>

You could also do

.random_class {
    clear: both
}
like image 186
Loktar Avatar answered Dec 10 '25 17:12

Loktar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!