4 ms·
<div class="text-italic"></div> Come on. <em>This is my italic text.</em>
by mark242 10y ago
<div class="text-italic"></div>
Come on.
<em>This is my italic text.</em>
- catmanjan 10y agoFrom a WCAG point of view you might want the top one instead, some screen readers read content in <em> in a different tone, which may not be intended.
- gkya 10y agoEven then the equivalent of an em or i is a span, not a div.
- gelatocar 10y ago<em> is a semantic element, and doesn't necessarily have to be italic. There are lots of use cases for italic text outside of <em>s.
- illicium 10y agoUse <i> if your use case is "alternate voice or mood" or "different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts" https://html.spec.whatwg.org/multipage/semantics.html#the-i-element https://html.spec.whatwg.org/multipage/semantics.html#the-i-...
- kagamine 10y agoUsing a framwork that generates html out of something else (XML but let's not get into the whys and whatfors) and I literally cannot use <em>, <i> or any other tag. I need to use a class and set the style in the CSS file. Edge case? Maybe. Just don't dismiss something that doesn't immediately fit your own use-case.
- deleted 10y ago[deleted]
- nicky0 10y agoShouldn't that be <span> not <div>?