What's the difference between and , and ?

前端 未结 22 2193
清酒与你
清酒与你 2020-11-22 08:10

What\'s the difference between and , and in HTML/XHTML? When should you use

22条回答
  •  清歌不尽
    2020-11-22 09:01

    As others have said and are explicit (i.e. "make this text bold"), whereas and are semantic (i.e. "this text should be emphasised").

    In the context of a modern web-browser, it's difficult to see the difference (they both appear to produce the same result, right?), but think about screen readers for the visually impaired. If a screen-reader came across an tag, it wouldn't know what to do. But if it comes across a tag, it knows that whatever is within should be emphasised to the listener. And therein you get the practical difference.

提交回复
热议问题