<span class="content"> only margins first line.

Discussion in 'CSS' started by X.Homer.X, Apr 21, 2008.

  1. X.Homer.X

    X.Homer.X Peon

    Messages:
    290
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #21
    using <h2> and <h3> messed up my page. The titles and sub titles on the news articles are now on separate lines, and have a huge space between them, i set my margins and padding to 0 on both and it doesn't fix it.

    heres my code

    
    <div class="news_title"><h2>&raquo; Welcome to Gamers Insanity</h2>&nbsp;<h3>Wipe your feet, and make yourself at home!</h3></div>
    
    HTML:
    
    h2 {
      font-size:10px;
      font-family:Verdana, Arial, Helvetica, sans-serif;
      font-weight:bold;
      padding:0;
      margin:0 0 0 3px; /*to create space away from left of box*/
    }
    h3 {
      font-size:10px;
      font-family:Verdana, Arial, Helvetica, sans-serif;
      font-weight:normal;
      padding:0;
    }
    
    Code (markup):
    whats wrong here?
     
    X.Homer.X, May 8, 2008 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #22
    Remember what I said about spans? This is one case where a span might be appropriate.
    <h2 class="news_title">
      &raquo; Welcome to Gamers Insanity<span>&nbsp;Wipe your feet, and make yourself at home!</span>
    </h2>
    =============
    h2.news_title {
      font-size:10px;
      font-family:Verdana, Arial, Helvetica, sans-serif; /*if this is the default font, it's redundant*/ 
      font-weight:bold;  /*headers default to bold; this is redundant*/
      padding:0;  /*redundant*/
      margin:0 0 0 3px; /*to create space away from left of box*/
      }
    
    h2.news_title span {
      font-weight: normal;
      }
    Code (markup):
    cheers,

    gary
     
    kk5st, May 8, 2008 IP
  3. X.Homer.X

    X.Homer.X Peon

    Messages:
    290
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #23
    okay, thanks, just before you and dan said to use headers for both of those (title and subtitle) i was just confused

    this should do nicely.
     
    X.Homer.X, May 8, 2008 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #24
    The way you've used the secondary part is more of a tag line. It can be treated as an extension of the header, as I did, or as a separate tag, which would be marked as a <p>. Look at the usage. It is not a sub-header in its own right.

    You must consider what the content is. It's always something within its context, and that something is never a lonesome span. A span always belongs to a semantic container. I figured this was all a header, with part of it displayed differently. Thus, the span.

    cheers,

    gary
     
    kk5st, May 8, 2008 IP