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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formatting heading with CSS 1

Status
Not open for further replies.

Bozette

MIS
Apr 1, 1999
43
0
0
US
I'm trying to learn CSS. One thing I thought I'd do is format the color, font, font size and alignment for some of the headings. It worked fine but there's more space below the them than I'd like. Is there a way to have less space after a heading? Or is there something other than headings that I should use?
This is what I used for one of them
Code:
h1 { color:#0000CC; text-align:center; font-size:24px; font-family:"Comic Sans MS"}
Thanks in advance
Boze
 
<h> tags are block level elements, and as such have a naturally occurring <br> after them, you can use Feherke's suggestion, to modify the margin and reduce the space between them.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Boze,

Something I do with every website I create is initialize all html elements to have 0 margin and padding. I do this because different browsers render different elements differently. An H1 tag may have a default padding of 1em in one browser, while it may have a default margin of 1em in a different browser.

Here is how you'd do that:

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

You can then specify a padding and/or margin for each specific element type, as demonstrated by Feherke above.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Ahhh.. thank you!. the
Code:
* {
    padding: 0;
    margin: 0;
}
also worked.

Thank you everyone for your help! I think I'm all set on this issue.
Boze

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top