span tag

Discussion in 'HTML & Website Design' started by thosecars82, Apr 7, 2008.

  1. #1
    hello
    i wanted to ask what the use of the span clause is when span takes no arguments like in:

    <div id="pageHeader">
    <h1><span>aaa</span></h1>
    </div>
    thks
     
    thosecars82, Apr 7, 2008 IP
  2. Gyrotive

    Gyrotive Guest

    Messages:
    15
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The span tag in your example will do nothing.

    It could be there for a css image replacement technique though. (Most likely if being used on a h1 tag).


    Read this:
    http://www.mezzoblue.com/tests/revised-image-replacement/
     
    Gyrotive, Apr 7, 2008 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Chances are it's a poorly implemented (and ultimately) inaccessible image substitution technique. Also note that a heading is a block-level element and doesn't need a DIV wrapped around it.

    Furthermore, just put the SPAN adjacent to the heading text, rather than around it, then set the heading's position to relative, and absolutely position the SPAN to the top and left.
     
    Dan Schulz, Apr 7, 2008 IP
  4. camp185

    camp185 Well-Known Member

    Messages:
    1,653
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    180
    #4
    When a site has used span tag without an ID or class, it has simply been styled by default in the css file. All span tags without the identifier will appear the same.
     
    camp185, Apr 7, 2008 IP
  5. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Whilst that is true, it is not necessarily the case. For example, in the OP's code that they gave us you could style that specific span like so, without having to give it a specific class or ID.

    #pageHeader span
    {
    someStuff: here;
    }
     
    nicangeli, Apr 7, 2008 IP
  6. camp185

    camp185 Well-Known Member

    Messages:
    1,653
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    180
    #6
    Uhh...that is what I just said.
     
    camp185, Apr 7, 2008 IP
  7. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Uhh...no it's not

    HTML
    
    <span> small text </span>
    
    <div id="pageHeading">
    <span> big text </span>
    </div>
    
    Code (markup):
    CSS
    
    #pageHeading span
    {
    font-size: 30px;
    }
    
    Code (markup):
    Note how the content in the two spans don't display the same and yet there is no argument applied to either spans...
     
    nicangeli, Apr 7, 2008 IP
  8. camp185

    camp185 Well-Known Member

    Messages:
    1,653
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    180
    #8
    Yes I did. you did not read my post correctly. "it has simply been styled by default in the css file".

    It does not matter where you put the style code, on the page, or in a css file, the point is this. All items within the plain span tag <span> will appear as defined in the style code for the tag span. Tags do not have to be labeled, and if you look at the original post of this thread you will see the code referenced. thosecars82 clearly states, "i wanted to ask what the use of the span clause is when span takes no arguments". The span tag has been styled in a css file or in style block above it somewhere.
     
    camp185, Apr 7, 2008 IP
  9. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I guess it sounded like you were saying spans have a default css styling. <span> has the same "default" styling as <div>: none.
     
    Stomme poes, Apr 8, 2008 IP