I am using <span> in my markup. It has to be there. What I need to know is how I can add a width to the span tag. I have a background color for the text inside the span tag, but it ends at the end of the tag. I tried to add a width property. but it doesn’t work. I need the background color to span farther than the text inside the tag. The only way i can find to do that right now is by adding but this isn’t an exact measurement so it’s not perfect. is there anything i can do here?
Try adding display: block; to your style for the span(s) in question. Inline elements don’t hold dimensions the same as block elements. One thing to note here is that if you change the display from inline to block you may have to float the element(s) as well, depending on how you want the layout to flow. Hope this helps.
Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘CSS’ is closed to new topics and replies.