Aligning H2's to the left inside a full justification...

Discussion in 'CSS' started by thebigbreak, Jan 7, 2007.

  1. #1
    I've got a blog that formats the titles in an h2 tag, and need to have them aligned left without full justifcation. Trouble is, the entire area that it fits in, a DIV, is set to justify.

    How can I make the H2's themselves not have the full justification? I tried using h2.classname and text-align:left in the CSS -- but it only works in FireFox.

    Any suggestions?
     
    thebigbreak, Jan 7, 2007 IP
  2. tyros8000

    tyros8000 Peon

    Messages:
    183
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i am not quite sure what you mean until i actually look at the code.

    but have you tried float:left on the h2 tag it sounds like that would fix your problem.
     
    tyros8000, Jan 8, 2007 IP
  3. thebigbreak

    thebigbreak Guest

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Tyros -- I've sent you a PM with the site in question.

    The float:left doesn't accomplish what I'm after, since it puts the first line of text under the headings right up against the H2's.
     
    thebigbreak, Jan 8, 2007 IP
  4. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well have you tried a span tag where the ID or class of the span has a CSS style with

    text-align: left;

    in it?
     
    Josh Inno, Jan 8, 2007 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    
    div {
        text-align: justify;
        }
    
    h2 {
        text-align: left;
        }
    ==========
    <div>
      <h2>generic header</h2>
      <p>text content</p>
    </div>
    Code (markup):
    cheers,

    gary
     
    kk5st, Jan 8, 2007 IP
  6. Austars

    Austars Active Member

    Messages:
    1,437
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    95
    #6
    Oh yes, isn't it that the most specifically defined attribute gets the highest priority? I'm just starting to learn CSS for real, and I think I'm actually understanding this :)
     
    Austars, Jan 8, 2007 IP
  7. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well I believe that any time you specify a new style, within another, the new style over-rides temporarily.

    So if I had an entire paragraph that was in italics, due to it being a quote, but then used a style that specifically did not have italics within that paragraph, I'd be turning the italics off.
     
    Josh Inno, Jan 9, 2007 IP