I have the code, as below. It’s a bit annoying to have the text not align (it affects other li elements). How can I make it a fixed-width? I’ve tried width=XYZpx but that did nothing.
<li class="date">2/28/2010 9:37:38 AM</li>
...
<li class="date">3/1/2010 9:37:38 AM</li>
css
li.date
{
background : url(/icons/date.png) no-repeat left top;
}
Assuming the following (x)html:
The width of the
lielements can be set by either setting the width of thediv#navigation(as theulandliwill default todisplay: blockat 100% width + padding + border-widths):Or by setting the width of the
ulOr by setting the width of the
lielements themselves:I think, unless there was a major typo in your question, that you’re trying to assign the width incorrectly, certainly as regards the
width=XYZpxthat you posted. To assign the width this way you should quote the value, so it becomes:But bear in mind that this is html/xhtml, not css. To set the width with css you should use either:
If you want to use inline-styles, or, in the stylesheet, use the form (as above):
Your comments regarding the text’s alignment suggests that your
lielements are perhaps inheriting padding, or a text-indent from somewhere, so you might want to add the styles:Hope this helps. If I’ve misunderstood your question, or problem, please feel free to drop a comment to my answer, or revise/edit/clarify your question, and I’ll try to be more useful.