Given the following markup:
<ul>
<li>apple</li>
<li class="highlight">orange</li>
<li>pear</li>
</ul>
Both the ul
's and the li
's widths appear to be 100%. If I apply a background-color
to the list item, the highlight stretches the full width of the page.
I only want the background highlight to stretch as wide as the widest item (with maybe some padding). How do I constrain the li
's (or perhaps the ul
's) width to the width of the widest item?