Will the <b> and <i> tags ever become deprecated?

不想你离开。 提交于 2019-12-17 06:05:11

问题


(This is more of a curiousity question than any pending disaster :D )

So the <b> and <i> tags have been around since near the beginning of the web (I assume). But now we have CSS and many people apposing "stylistic html tags." They are stylistic tags, but they're really not so bad, as they save us from having to make a <span class="bold"> a whole bunch of times, reducing download times. Seeing as they don't take up much space, are easy to use, can possibly be useful to screen-readers, search engines, and other applications that don't care much about how a document looks, and removing them would break TONS of html code, I'm guessing probably not, but I still wanted to bring up the topic. :)


回答1:


If you end up doing <span class="bold"> a lot you are not correctly using either span, nor class names. Class names should tell you what the tag is, not what it looks like.

The correct replacement for <b> and <i> are <strong> and <em>, and they should be used to note that the specific text inside has a different meaning than the surrounding text.

Update: New specification for <b>, <i>,<strong>,<em> released under HTML 5

In HTML5 <b> and <i> have specific meaning as do <strong> and <em>. Use them all as specified.

4.6.2 The em element :

The em element represents stress emphasis of its contents.

4.6.3 The strong element:

The strong element represents strong importance, seriousness, or urgency for its contents.

4.6.16 The i element:

The i element represents [...] otherwise offset from the normal prose [...], such as a taxonomic designation, a technical term, [...].

4.6.17 The b element:

The b element represents a span of text to which attention is being drawn for utilitarian purposes [...], such as key words in a document abstract, product names in a review [...].




回答2:


they are not deprecated in HTML 4.01, and they won't be deprecated in HTML 5. for reasons:

The inclusion of these elements is a largely pragmatic decision based upon their widespread usage, and their usefulness for use cases which are not covered by more specific elements.

While there are a number of common use cases for italics which are covered by more specific elements, such as emphasis (em), citations (cite), definitions (dfn) and variables (var), there are many other use cases which are not covered well by these elements. For example, a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, or a ship name.

Similarly, although a number of common use cases for bold text are also covered by more specific elements such as strong emphasis (strong), headings (h1-h6) or table headers (th); there are others which are not, such as key words in a document abstract or product names in a review.

Some people argue that in such cases, the span element should be used with an appropriate class name and associated stylesheet. However, the b and i elements provide for a reasonable fallback styling in environments that don't support stylesheets or which do not render visually, such as screen readers, and they also provide some indication that the text is somehow distinct from its surrounding content.

In essence, they convey distinct, though non-specific, semantics, which are to be determined by the reader in the context of their use. In other words, although they don’t convey specific semantics by themselves, they indicate that that the content is somehow distinct from its surroundings and leaves the interpretation of the semantics up to the reader.

This is further explained in the article The <b> and <i> Elements.

Similarly, the small element is defined for content that is commonly typographically rendered in small print, and which often referred to as fine print. This could include copyright statements, disclaimers and other legal text commonly found at the end of a document.




回答3:


No. <i> and <b> are not deprecated, at least not in HTML 4. One situation in which they may apply would be a list of references. For example, in Germany references are given in the following way:

Author: Title. Publisher, Year, ...

In this case the title is defined to be italic. It's no special emphasis (as would be signified by the <em> tag) but really italic.

ETA: And yes, you should use the <cite> element as well. But my point still stands:

<cite>Author: <i>Title.</i> ...</cite>

Wikipedia also uses both tags extensively, last time I looked.




回答4:


b and i have no semantical meaning. If you want just bold text, use b, but any other cases you should use strong and em




回答5:


I believe the "separate style from presentation" guideline is to use <em> and <strong> instead of <i> and <b>, no <span> required.




回答6:


According to http://www.w3.org/TR/html401/index/elements.html they are not currently deprecated.




回答7:


Great question, and I'd suggest that:

YES, they SHOULD be deprecated. They're a styling tag, and add no content.

No, they WON'T be deprecated because they're so ingrained that it'd be a nightmare to take out.

That said, very likely that all browsers would continue to support the <b> and <i> tags.




回答8:


Don't forget the IE-6 browser folks!!
This browser has partly problems with the <strong> tag when it is used inside the caption of an <a></a> tag.
example:
<a><strong>Hello</strong></a>
The IE-6 creates a linebreak at the screen before the opening <strong> tag and after the closing </strong> tag. Not so by using the <b>(bold) tag instead. Everything is shown correctly then.

regards, Matthias




回答9:


  1. They are non-semantic, and tread on CSS' toes.
  2. No, too many people like quick, dirty methods too much.



回答10:


I doubt very much whether browsers would drop support for them. However, if the W3C validater raises an error for pages utilising them then I feel, over time, there use will depreciate. It takes time, but people do change habits - look at the once ubiquitous FONT tag, for instance.




回答11:


<b> and <i> are not structural or semantic elements. You want your HTML to be semantic/structural and your CSS to contain the styling.

See here or here




回答12:


In XHTML 2.0 they are. I'm not sure about HTML 6 (if that ever comes), but I think it will. But it's really useless to think about it right now, since in 2130 the same browsers must still work and the nowadays website must still be available for anyone then. You can always change it later using javascript or something.




回答13:


You can see it as tags which have "by coincidence" the same default styles as <b> and <i>. You should not see it as an exact replacement of <b> and <i>, but you should use it whenever the content has actually a semantically strong or emphasized meaning. You're however free to style it further to your taste.




回答14:


I know that this thread is old but posting this info for future references and updating purpose

In HTML5 <b> and <i> have specific meaning as do <strong> and <em>. Use them all as specified.

4.6.2 The em element [WHATWG.org...]

www.WHATWG.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-em-element

4.6.3 The strong element [WHATWG.org...]

www.WHATWG.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-strong-element

4.6.16 The i element [WHATWG.org...]

www.WHATWG.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-i-element

4.6.17 The b element [WHATWG.org...]

www.WHATWG.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-b-element




回答15:


if they become deprecated, the name "HTML" as is (hypertext markup language) would become senseless. as it wouldn't be the html-code marking some text as bold but it would be the CSS.

in my opinion: no, they don't get deprecated too soon...

regards



来源:https://stackoverflow.com/questions/1348683/will-the-b-and-i-tags-ever-become-deprecated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!