8
I’m trying to create a list with 4 blocks, but they don’t align side-by-side correctly, they’re like this:
I wish they’d stay that way:
HTML:
<li></li>
<li></li>
<li></li>
<li></li>
CSS
#test li {
width: 230px;
height: 140px;
margin: 0;
border: 1px solid red;
background: #999;
float: left;
overflow: hidden;
}
Why aren’t they lining up?
Does the parent section have a fixed size? The
float: left
will not help if the section occupies a variable size with the browser resize.– rodrigogq
I don’t understand, buddy, how so section dad?
– Thiago
<div id="pai"><ol><li></li></ol></div>
In this case, your<ol>
or your<div>
haswidth
specified? Or when you resize your browser<li>
are moving?– rodrigogq
Yes, the div is 1000px in size.
– Thiago
In this case the
float: left
will make the element float and fill the space that is available. You need to increase the size of thewidth
of theirli
(something like 500px maybe) or changeli
fordiv
.– rodrigogq