Reputation: 12588
I have this code (JSFiddle):
ul {
list-style-type:none;
margin:0;
padding:0;
}
li {
border:1px solid grey;
display:inline-block;
}
div {
position:absolute;
}
<ul>
<li>
One
</li>
<li>
Two
<div>Some content</div>
</li>
</ul>
This positions the div directly below Two
.
Is it possible to move the div to the far left (i.e. below One
) with just CSS?
Upvotes: 0
Views: 1335
Reputation: 3297
Setting the parent UL to position: relative
will allow for absolute positioning from within a child LI.
ul {
list-style-type:none;
margin:0;
padding:0;
position: relative;
}
li {
border:1px solid grey;
display:inline-block;
}
div {
position:absolute;
left: 0;
}
<ul>
<li>
One
</li>
<li>
Two
<div>Some content</div>
</li>
</ul>
Upvotes: 3