h1 css modifying

Discussion in 'CSS' started by fotoviva, Jan 11, 2007.

  1. #1
    Hi, I have started using the h1 and h2 tags for better SEO and have changed the style of them in my css file to better suit the design. However, one problem I have come across is that it always gives too much space at the top and bottom of the h1 text. Is it possible to change this?

    Thanks
     
    fotoviva, Jan 11, 2007 IP
  2. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ad this to your css

    margin: 0;
    padding: 0;

    you can always change the 0 to whatever, like 5px, 1em etc
     
    just-4-teens, Jan 11, 2007 IP
  3. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #3
    ah! Something so simple - thanks :)
     
    fotoviva, Jan 11, 2007 IP
  4. duilen

    duilen Active Member

    Messages:
    354
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #4
    It's even possible to add negative margin if needed.
     
    duilen, Jan 14, 2007 IP
  5. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #5
    Yes, definitely. I myself use negative left margins ocasionally to adjust the position of headings..
     
    Clive, Jan 15, 2007 IP
  6. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #6
    thanks folks!
     
    fotoviva, Jan 15, 2007 IP
  7. MattD

    MattD Peon

    Messages:
    161
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You can tweak it even further by using margin-top and margin-bottom, or you can supply 4 values for margin for top right bottom left - e.g. 5px at the top, 10px at the bottom would be margin: 5px 0 10px 0 (format is margin: T R B L)

    Negative margins are really useful! :D
     
    MattD, Jan 15, 2007 IP