0
My question is : whats the roll of the emphase tag <em> </em> in the html?
Am just learning the html but i didnt get whats the roll of the emphase tag The sentence is the same when i add or not add <em> </em> Thank you
2 ответов
+ 3
The idea with modern web development is to clearly separate
- the structure (HTML)
- the presentation (CSS)
- and the behaviour (JS)
The <i> tag defines italic font style, which is a presentational quality of the text.
On the other hand <em> specifies that this text must be emphasized from its context, but does not say how exactly, even though the browsers show this as italic text by default. But this is a semantic description of that content, not an instruction how it should be displayed.
It is always preferable to use elements with semantic meaning (strong, em, section, nav, footer...) rather than tags that imply explicit formatting.
Practically you can override the display style of either tag in CSS, for example you can define a different background colour or different font for the emphasized text.
https://www.sololearn.com/Discuss/237558/?ref=app
https://www.sololearn.com/Discuss/1397667/?ref=app
+ 1
<em> emphasises the text i.e. makes it to stand out for the screen readers