Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

H1's H2's etc... 1

Status
Not open for further replies.

JamesGMills

Programmer
Aug 15, 2005
157
GB
When you use H1's etc and view them in IE7 it puts big gaps at top and bottom.

I dont want this however even trying to fix everything does not seem to make a difference... am i missing something?



------------------------
 
Yes - you need to style the margin and padding to be 0:

Code:
<style type="text/css">
h1, h2, h3, h4, h5, h6, h7 {
   padding: 0px;
   margin: 0px;
}
</style>

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
further, whenever i'm designing a website i put this at the top of my CSS file:

Code:
* {
    padding: 0;
    margin: 0;
}

different browsers provide different paddings and margins to different elements, which makes perfecting your site quite painful. the code above starts all elements with the same padding and margin (none) so you can then completely control the padding and margin for each element.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Cory,

That's pretty cool. I assum he * represents all html tags. I'm wondering if you set any other defaults but decided to just show the padding and margin to make the post easier to understand.

I guess my question is... Are there any other defaults you normally set?

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George,

in my most recent development engagement, i also included

Code:
border: 0;

because borders are sometimes rendered differently (think fieldsets, input fields, table cells, etc.).



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
I was just about to mention borders Cory [smile]

I did it specifically because I'd notice borders always being stuck around images by default.

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
ahh yes, that too.

when you surround an img tag with an anchor tag, they sometimes miraculously inherit an ugly blue border. that's the reason i started with the global border: 0;.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thanks guys. Stars all around for sharing that information.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top