Styling an h1 tag but it keeps friggin wrapping!

Discussion in 'CSS' started by GeorgeB., Oct 7, 2008.

  1. #1
    I have an h1 tag and i have it styled like I want it to look.

    Except for one thing... When the text in the H1 tag is too long it wraps around to a new line. (And that's fine that's what I want it to do.)

    But the text that wraps under it bunches up and overlaps the text above it. How do you stop that?

    Here's my code

    #mainquestion h1 {
    color:#000000;
    font-size:3.0em;
    font-weight:bold;
    letter-spacing:-.1em;
    }
    
    <div id="mainquestion">
    			<h1><strong>The Main Question Text Is A Little Long But Sometimes I Need It To Be.</strong></h1>
    </div>
    </div>
    Code (markup):

     
    GeorgeB., Oct 7, 2008 IP
  2. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #2
    OK I set up a link to a live example here. http://www.nicecomeback.com/test/

    That's the exact same CSS file I'm working with.

    It looks like it's not my code I pasted above that's causing it. But some other element in the CSS. Because when I created the style.css with JUST the mainquestion element defined it worked fine with no overlap.
     
    GeorgeB., Oct 7, 2008 IP
  3. mjewel

    mjewel Prominent Member

    Messages:
    6,693
    Likes Received:
    514
    Best Answers:
    0
    Trophy Points:
    360
    #3
    Try adding a line-height to the style
     
    mjewel, Oct 7, 2008 IP
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I don't understand your problem exactly, when you say "bunches up and overlaps the text above it", I think it could be due to your letter-spacing, why is it a negative number?

    Also is H1 the only thing inside the mainquestion DIV, if so then there's no need for this DIV.
    Also is there any real reason for having strong tags inside the H1, as you already have font-weight: bold; set?
     
    wd_2k6, Oct 7, 2008 IP
  5. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah line-height is probably it, if John McCain was a Muslim what's the problem George?
     
    wd_2k6, Oct 7, 2008 IP
  6. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #6
    nevermind got it.

    It was the body: verdana, arial, geneva, sans-serif;
     
    GeorgeB., Oct 7, 2008 IP
  7. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #7
    John McCain is not a Muslim.

    It's just as ridiculous as the people claiming Barack is a Muslim.

    That's the point... :)
     
    GeorgeB., Oct 7, 2008 IP
  8. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #8
    OK sorry :)
     
    wd_2k6, Oct 7, 2008 IP