Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    don
    don is offline
    New Coder
    Join Date
    Sep 2002
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Removing margin before first H1

    Firefox puts a space before all H1 tags, including the first. IE doesn't.

    Is there a better way to handle that than to do this? I'd rather not do it like this on every page.

    <h1 style="margin: 0">First Header1</h1>
    <h1>Other Header1</h1>

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    h1 {
    margin: 0;
    }


    <h1>First header, most important</h1>
    <h2>Other header, not quite as important</h2>
    <p>Remember to code semantically!</p>

  • #3
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Just to clarify what rmedek is saying, you should only have one H1 in your document. And it would usually be your site name.

  • #4
    don
    don is offline
    New Coder
    Join Date
    Sep 2002
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Gotcha.

    Thanks.

  • #5
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts

    kill margins

    Or if you wanted to dispense with having to deal with different browsers assigning different margins/padding to elements, you could always try this:

    Code:
    * {
        margin: 0;
        padding: 0;
    }
    Though I've not tried it myself yet

    Gary

  • #6
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    I learned that trick from Andrew (mindlessLemming)... that is the "MOST AWESOME CSS TIP EVER" . It certainly saves a lot of hassle.

  • #7
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rmedek
    I learned that trick from Andrew (mindlessLemming)... that is the "MOST AWESOME CSS TIP EVER" . It certainly saves a lot of hassle.
    It sure do...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •