Is it ok to use in place of blindly?

前端 未结 8 853
清歌不尽
清歌不尽 2020-12-02 15:38

Note: I know is presentational and is a better way, and

8条回答
  •  一个人的身影
    2020-12-02 15:52

    We shouldn't swap b and strong blindly as they have different intended purpose.

    > and are not presentational elements as per the HTML5 spec. They have a different meaning and purpose. Quoting the HTML5 specs,

    The b element represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is boldened.

    and for the i element,

    The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized.

    As others have very well clarified, i and em cannot be used interchangeably and so is the case with b and strong.

    The usage of i and b for their intended purpose is very rare. (eg. in dialogue scripts, thesis, resumes)


    References:

    1. http://html5doctor.com/i-b-em-strong-element/
    2. http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-i-element

提交回复
热议问题