Which HTML Selectors are block elements and which are inline elements by default?
We have talked about the display property before, but I just wanted to make note here what the defaults are for a select few HTML Selectors.
Elements that default to display:block, and will force a break, are;
p, h1, and div
Elements that default to display:inline and will stay as the name says, inline with other elements, are;
strong, span, and em
Remember, you can change the rules for all of these selectors in your external style sheet in how they display. Here is an example of what you write;
h1, h1, h3 {
display:inline;
}
span {
display:block;
}
In the second example for the redefined span tag, here is what would happen.
The redefined span element with a display of block will now force a break mid line.
Here are some similar arcade posts
- Formatting Ordered lists so they look like an outline in Microsoft Word.
- How do I turn the visibility off on a layer (div block)?
- Style sheet precedence in table cells and stylesheets
- How can I turn off scrolling if I know that I don’t need it on a webpage?
- What are Conditional Comments in Internet Explorer?
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.











Comments
No comments yet.
Leave a comment