Jump to content

Archived

This topic is now archived and is closed to further replies.

johnnyk

display:inline and other stuff

Recommended Posts

I read somewhere that if you want to display an element without space above and below it (such as the h1 tag, which by default does), you should use {padding: 0px; margin: 0px} instead of {display: inline}

On the same page, they also said that you should try to avoid putting <br /> after h1-h6 tags. How would I have the next element appear on a new line without doing that?

And if you feel like it I have 2 more questions:
-In general, what's better {font-size:12px;} (or whatever px) or {font-size:100%}
-When should I use IDs instead of classes. I read that you should use IDs when there's only one occurrence, but is there actually any benefit to doing that. What's so bad about using classes for something that occurs once?

Share this post


Link to post
Share on other sites
[quote]I read somewhere that if you want to display an element without space above and below it (such as the h1 tag, which by default does), you should use {padding: 0px; margin: 0px} instead of {display: inline}

On the same page, they also said that you should try to avoid putting < br />
after h1-h6 tags. How would I have the next element appear on a new line without doing that?[/quote]
I usually apply a top and bottom margin for the header elements, like so:
[code]h1, h2, h3, h4, h5, h6 {
    margin: 5px 0px 10px 0px;
}[/code]
I've nevery used display:inline on headers.

Share this post


Link to post
Share on other sites
How big (in %) is the margin created by a <.br />, or should I not use %?
In general, how big is the margin created by <.br />?

Share this post


Link to post
Share on other sites
The gap between the line is depends on the size of your font.

Share this post


Link to post
Share on other sites
So say it's size 16 font, what would the gap be? Or does it not really matter how big I make the gap?

Share this post


Link to post
Share on other sites
The gap will be nothing. When you use < br /> it makes the text go to a newline until you use two or more < br> tag then they'll be a gap, but the gap depends on the size of your font. So if your text was 24px each line will have a gap of 24px.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.