Jump to content

display:inline and other stuff


johnnyk

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?
Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.