CSS text-decoration

Discussion in 'Web Design and Development (archive)' started by mms, Jan 23, 2004.

  1. mms
    macrumors 6502a

    Joined:
    Oct 8, 2003
    Location:
    CA
    #1
    In CSS, is there a way to format only part of the text on a line? Specifically, I would like to make one part of a line underlined and another part normal text. I would like to refrain from using <u>, which is depreciated.

    What I am trying to do is rewrite this page.
     
  2. mms
    thread starter macrumors 6502a

    Joined:
    Oct 8, 2003
    Location:
    CA
    #2
    BTW, here is the code I've written so far.
     

    Attached Files:

  3. Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #3
    I'd use a <span> tag with the underline class.

    So...

    Code:
    <p>Here is some general text, but only <span class="underline">these words</span> should be underlined.</p>
     
  4. macrumors regular

    Joined:
    Oct 17, 2003
    #4
    What's the deal with <span> tags? I don't use them because it seems like they're usually hit and miss. <div> tags seem to be much more consistent.


    Or maybe I'm using them wrong. That's probably it. Can <span> tags only be used within <p> tags or something?
     
  5. Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #5
    <div> tags are block-level elements, while <span> tags are inline. So <div>s work best for layout and <span>s for inline styles within a block-level element, such as a <p>, <li>, <h1>, etc.
     

Share This Page