Is span the only way to do this?

Discussion in 'HTML' started by KiwiBrian, Mar 5, 2005.

  1. KiwiBrian

    KiwiBrian Guest

    If I have some text strings on a page, e.g. headings, or paragraphs, and I
    want them to have a background colour behind just the text, is use of the
    span tag surrounding/enclosing the text the only way of achieving this?
    Of course I would want it to adjust to any client resizing of the text, or
    if characters were added or removed in the source.
    I was surprised to find that paragraphs are the width of their container and
    not the width of the text string, but no doubt there is a good reason for
    this.

    TIA
    Brian Tozer
    KiwiBrian, Mar 5, 2005
    #1
    1. Advertising

  2. KiwiBrian

    mscir Guest

    KiwiBrian wrote:

    > If I have some text strings on a page, e.g. headings, or paragraphs, and I
    > want them to have a background colour behind just the text, is use of the
    > span tag surrounding/enclosing the text the only way of achieving this?
    > Of course I would want it to adjust to any client resizing of the text, or
    > if characters were added or removed in the source.

    ....
    > TIA
    > Brian Tozer


    Try applying a background-color to the various page elements, or a span.
    Using a span for inline text is probably the easiest way to do what you
    want.

    http://www.blooberry.com/indexdot/css/properties/colorbg/bgcolor.htm
    http://www.codeave.com/css/code.asp?u_log=4007
    http://www.w3schools.com/css/tryit.asp?filename=trycss_text_background

    Mike
    mscir, Mar 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fulio Open

    Can span include span?

    Fulio Open, Jun 26, 2009, in forum: HTML
    Replies:
    5
    Views:
    545
    dorayme
    Jun 26, 2009
  2. Stéphane Klein
    Replies:
    2
    Views:
    1,752
    John Nagle
    Mar 30, 2010
  3. Stefan Behnel
    Replies:
    0
    Views:
    482
    Stefan Behnel
    Mar 29, 2010
  4. Dan Bishop

    DataGrid (body only) contained in <span>...</span> tags

    Dan Bishop, Jun 7, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    275
    Kilic Beg
    Jun 7, 2004
  5. Wang, Jay
    Replies:
    5
    Views:
    467
    Wang, Jay
    May 25, 2004
Loading...

Share This Page