SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: H2 Padding

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    H2 Padding

    Hello everyone,

    Having a few problems with my h2 tags. I want to get rid of the padding that naturally occurs. Anyone know how to do this?

    I tried
    Code CSS:
    	padding:0px;
    	margin:0px;

    but to no avail.

    If you could enlighten me that would be brilliant.

    Mike

  2. #2
    SitePoint Wizard bronze trophy Centauri's Avatar
    Join Date
    May 2007
    Location
    Newcastle, Australia
    Posts
    3,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If that is in the css for the <h2> tag :
    Code:
    h2 { padding: 0; margin: 0;}
    then it should work (units not required when value is zero) - the only other thing that will effect the height is the line-height.

  3. #3
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i did it exactly like that but it doesnt seem to work.

    Any ideas?

  4. #4
    .* draziW tnioPetiS *. bronze trophy
    Join Date
    Jun 2004
    Location
    "Then I figure the most good good guy will win."
    Posts
    1,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is basic example.

    Does that help?

  5. #5
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you could post your fullcode then it'll be easier to see what the problem is. Removing the padding and margin should work as you've done so presumably there's something else that has padding or margin's after the h2 that you haven't considered?

    I'd tend to use

    Code:
    * {
      padding: 0;
      margin: 0;
    }
    at the beginning of my CSS to ensure that all default padding and margin's are removed and then apply it where I want it

    If that doesn't help though then please post your fullcode and we'll take a look.

  6. #6
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help guys, csswiz your trickery seemed to work perfect.

    Mike

  7. #7
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It'll have probably been padding or margin's on the top of elements that followed on from the h2.

    Remember that using the method above removes padding and margin from everything so for something's you'll need to reapply it. For example, lists will need them reapplying and it can cause problems with formfield formatting but as long as you're aware of potential problems then it's the easiest method.

  8. #8
    .* draziW tnioPetiS *. bronze trophy
    Join Date
    Jun 2004
    Location
    "Then I figure the most good good guy will win."
    Posts
    1,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For more info on the star reset, and other approaches, this thread also has some good info.


Bookmarks

Posting Permissions

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