Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS help with the span tag

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22781
    cybershot
    Participant

    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 &nbsp; but this isn’t an exact measurement so it’s not perfect. is there anything i can do here?

    #47945
    mkyuzo
    Member

    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.

    Best Regards,
    Mike

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.