say you are working without the <p> element in HTML. How would you stylize a simple text with css? What HTML-Tag would you take? I always used <span>, but now I saw that span should always be used to group inline-elements (for example <p>). And thats not the case in my example.
Thanks, phpheini
First you should look whether some tag matches semantically. For instance, you might have a text which requires emphasis, in which case em is the best choice. Another case is if you have a heading, which you could style with h1, ..., h6. Always first consider this option!
If there really is no meaning to the text you want to style, or at least, not a meaning supported by css, you can use either span (for inline text) or div (for block elements).
You're free to use any tag you wish... (Within reason); Just make sure it's semantic.
Just a few you could use:
<div> <em> <strong> <small> <pre>
<div>
Div tags are basically <span> tags for block elements instead of inline elements.
加载中,请稍侯......
精彩评论