How to creat header tags with using CSS??

Discussion in 'CSS' started by edt123, Nov 20, 2008.

  1. #1
    Hi,

    Please can any one Help How to create Header Tags(H1, H2, H3, ......) Using CSS???




    Regards
    EDT123
     
    edt123, Nov 20, 2008 IP
  2. mahendra rajeshirke

    mahendra rajeshirke Active Member

    Messages:
    402
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    if u wnt to creat h1 tag without typing any h in html code and wnt to creat this h1 tag by make changed in css file, then i dont know,

    if u wnt give h1 tag a property without giving it any class or id , u can cread

    h1{}

    in css then whererver h1 is exist in ur linked css files , they can be changed automaticaly according to ur css property,
     
    mahendra rajeshirke, Nov 20, 2008 IP
  3. Divisive Cottonwood

    Divisive Cottonwood Peon

    Messages:
    1,674
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Like this.

    HTML code:

    <h1> This is a header </h2>

    CSS code:

    h1 {
    font-weight : bold;
    }

    The above code would embolden the heading
     
    Divisive Cottonwood, Nov 20, 2008 IP
  4. bigroddy

    bigroddy Peon

    Messages:
    78
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I think you meant:

    <h1> This is a header </h1>

    Can't close an h1 tag with a closing h2 tag...wouldn't validate
     
    bigroddy, Nov 20, 2008 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There is a way to make a header with css... but not in IE.

    There's the :before and :after pseudo elements which can add content dynamically.
     
    Stomme poes, Nov 20, 2008 IP
  6. Divisive Cottonwood

    Divisive Cottonwood Peon

    Messages:
    1,674
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #6
    How would that work then?
     
    Divisive Cottonwood, Nov 20, 2008 IP
  7. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hmm, since IE doesn't support them I don't use them.

    But looking into it, I was wrong-- you can insert the content, but not the tag (though if you made the tag in the "content" part, I wonder if the browser would just parse it like a tag) :
    <div id="foo">
    </div>

    #foo:before {
    content: "<h1>Foo Man Choo</h1>";
    }


    But technically "content" outputs a string, not anything else. I've never looked to see what a browser would do with that. I would think it'd be:

    <div id="foo"><h1>Foo Man Choo</h1></div>
    Not that h1's belong in divs, but I guess if you wanted the same h1 at the beginning of each page container div or something, it might work. But again content isn't supposed to be parsable stuff, just CDATA, but how's a browser gonna know not to pay attn to those < and >'s?
     
    Stomme poes, Nov 20, 2008 IP
  8. mahendra rajeshirke

    mahendra rajeshirke Active Member

    Messages:
    402
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #8
    who says IE doesnt support css, if u meant in ur post
     
    mahendra rajeshirke, Nov 20, 2008 IP
  9. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Re-read my post.
    Referring to :before and :after. IE6 and IE7 do not support those selectors, therefore I do not use them.
     
    Stomme poes, Nov 22, 2008 IP