blah
blah1

CSS float left divs go lower with lower screen resolution

I have two divs, they look like this:

<div style="float:left;">blah</div> <div>blah1</div> 

In x screen resolution, they look as planned:

blah blah1

However, when the screen resolution is less than x, they look like this:

l

blah1

This is a width error. How can I make my divs adjust the width to prevent this from happening? My widths are set as percentages, not fixed pixel lengths.

NOTE. If possible, I need a way to fix this with auto-width. Change the content on the page, so I can’t even set the percentage width .... Unless NECESSARY NECESSARY !!

+4
source share
1 answer

Just set the field to the second div :

 <html><head></head><body> <div style='float:left;width:200px;background:yellow'>First Div</div> <div style='margin-left:200px;background:orange'>Second Div</div> </body></html> 

... and it will fill all the extra space every time.


The markup above is as follows:

enter image description here

+2
source

Source: https://habr.com/ru/post/1445416/


All Articles