So the intent for this snippet is to allow the paragraph on left to display a right border spanning the height of the parent container, which it manages to do under display:table for both the container article and paragraph if said rules are set. The ul following it is meant to be placed right to it, that too is working. The list entities are preferably allowed to float such that more than one bullet can be on a single line.
Now, when float:left is added to the li tags... the para text goes from starting up top in its cell, to starting below the last line of bulleted entries.
I know float:left is the problem since removing it rectifies the issue, but it then makes the list 1 bullet/line... something I'd rather not do.
Why is the float for the li tag repositioning the text on an item it isn't written to affect? I tried inspecting elements and I don't see any text-alignment being calculated afaik.
The HTML:
<article class="foo" id="bar">
<p> List on right causes my text to move down?</p>
<ul>
<li>why</li>
<li>yes</li>
<li>we</li>
<li>do!</li>
<li>why</li>
<li>yes</li>
<li>we</li>
<li>do!</li>
</ul>
The CSS:
.foo {
display:table;
width: 20em;
}
.foo p {
text-align: right;
padding: 0 1em 0 0;
border-right: 1px solid #999;
display: table-cell;
width: 10em;
}
#bar ul
{
width: 10em;
}
#bar li {
float: left;
width:2em;
margin-right:3em;
}
The JSFiddle snippet can be seen here: http://jsfiddle.net/U39ab/1/