As we are moving on to HTML5, there are some tags which now hold a very least importance that it did in the past.For example <dl>
the defination list, I dont remember the last time used this tag.
And not only this, but there are tags which have a better and more efficient versions or just clear redundancy like <strong开发者_Python百科>
and <b>
, <basefont>
and <font>
etc.
In your Opinion, which are the tags that as a developer you can live out with?, and Which are the tags which can be ignored? because we have a better version.
B
and STRONG
are not the same thing, and neither are I
and EM
.
EM
means that the text shoud be emphasised. This thus says something about how the text should be interpreted, and this is understood by screen-readers (text-to-speach), etc. It has a logical meaning. I
, on the other hand, says nothing about the semantics -- it simply tells the HTML renderer to render the text in italic. Hence, in text, to make an emphasis, use EM
. If you for some reason need a bit of text to be in italic without this implying that the text should be emphasised, then you can use I
.
The same things applies to STRONG
and B
.
However, I really dislike FONT
, because it says nothing about the semantics. Use Hn
for headers, EM
for emphasis, CODE
for code, etc. If you lack some tag for some context, define a CSS rule like
<p class="footer">...</p>
or
<p>This is <strong class="extraordinaryEmphasis">extremely</strong> important.</p>
It was suggested I make this an answer, so here is an excellent page that discusses which tags and attributes should be avoided in HTML5 pages, and why, though he doesn't include elements like the blink
tag.
http://www.html-5.com/avoid/
STRONG and B have distinct semantic meaning now. There was a lot of effort to clean up semantically-ambiguous elements like that. Even HR got some attention.
I use DL all the time, personally. It my workhorse KeyValuePair type. I sometimes find myself wishing it had more rigorous semantics, but then other times I'm thankful for its flexibility in allowing me to define its semantics contextually.
I suppose it depends on your definition of 'useless', which I take to mean 'having no practical use whatsoever'. I don't really know of any element in HTML5 I could say that I'll never use under any circumstances.
P should be abandoned. No Joke. It creates artificial breaks in flowing text that can be better reproduced with a line break. Is there a P tag on a typewriter? What follows is that it becomes a "text container" that we've become dependent on for no good reason. Paragraph is a stylistic flow marker only. At most it should be a singleton tag. In CSS, I use it simply as a text-area container, a designation which is similar to SPAN except in block form. The P should really be a TEXTSPAN tag that can be parent to multiple spans, but not to itself. We are often forced to store some representation of P in databases, which then are impossible to reconstruct for display. Again, a double line break is much more appealing and universal.
:-)
<code> is useless. Unless maybe you a perl one-liner fan. It should have been a semantic way to create a <pre> block - that would have been useful.
<embed> is useless. It is redundant to <object> and less capable than <object>
<small> is useless. It has no semantic meaning and should be done with CSS.
Those are my opinions of the three most useless tags that made it into the HTML5 spec.
I think that anything that indicates something that should be done in CSS is probably something that should be avoided. This includes
<b>,<strong>
<i>,<em>
<center>
<u>,<strike>
My least favourite has be to <font>
, as it has absoutely no meaning, and should, in all instances be replaced with a tag.
Personally, I think it's also good to avoid HTML attributes that should be done with CSS such as "color" and "border".
精彩评论