OK - so why in this instance, where I have removed the padding altogether from the ul and the 3 li’s, do the borders of the li’s stretch all the way to the right? Shouldn’t they terminate immediately after the words as I have drawn with the 3 black vertical lines? In a similar vein, what’s that small strip of green doing to the L of the borders? Without padding, it shouldn’t be there should it?
The padding is what kept those lines from going any farther. When you remove the padding, it can stretch to the edge of the screen (or the edge of that container, wherever that may be).
The <li> elements, being block, will by default stretch to the right until the edge of the container. If you want them to conform to the width of the words, you can make them inline (or inline-block), but then they won’t automatically be on their own line. There are ways around this but it can be tricky.
li {
display: inline-block;
}
The easiest thing to do is to keep the <li> elements block and wrap the contents in something like a <span> then style the span. The span will wrap to the text because its inherently inline.
I copied those 3 li’s that now include the “span” tags but it made no difference to the output - the background colors and the borders still go all the way to the R side of the page so I think the answer must lie in " wrap the contents in something like a - span - then style the span". Problem is - I have no idea how to style this element called span
This time I put padding values back in - just a single value mind you - which is supposed to - When one single value is provided, the padding value will apply to all four sides of the element (ie: top, right, bottom, left). But the padding value only seems to apply to the Left, Top, Bottom - on the RS the padding goes way beyond any padding value that I have for the various vehicles. This code still has the span tags which as I said previously, haven’t made a difference. A mystery to be sure!
Note that you may not want ALL of the styles to get applied to the spans. You’ll need to play around with it until you get what you want (IF this is what you’re after).