3 ms·
Awesome article. Like the author, I'm also confused about when to use b and strong & i and em.
by arun-mani-j 3y ago
Awesome article.
Like the author, I'm also confused about when to use b and strong & i and em.
- xigoi 3y ago<em> is for emphasis, <i> is for other things that typically use italic text (except those that fall under <dfn> or <var>), such as foreign words. Analogously for <strong> and <b>.
- karaterobot 3y agoI had thought that <b> and <i> describe how something should look, whereas <strong> and <em> describe the meaning of something. <b> means "this text should be thicker and darker than it normally would be", <strong> indicates "this text has gravitas... interpret that however you want". In other words, visual vs. semantic.
- vlz 3y agoI have heard similar but the consequences always seemed weird to me. Following this if something is important and also should look visually different, I should use both <strong> and <b>. However If something is important and I don't want it to show, I should use <strong> alone and <b> alone only for the case where something should look important but that has actually no meaning as the meaning conferring tag would be <strong>.
- Kerrick 3y agoThe quintessential semantic use of <b> is for typographically offsetting key words in a longer text, like how 5th Edition D&D adventures do when referencing a monster that has a stat block in the Monster Manual. It’s not strength of voice, but it has meaning that the text be emboldened.
- david2ndaccount 3y agoJust use b and i, em and strong are bloat and are harder to type if you are hand-writing html. The semantic web is dead anyway.
- zarzavat 3y agoI’m not sure if screen readers actually work like this but the intention was that text that is <em> is spoken with emphasis, like “oh, please”, whereas <i> is simply italic, like veni, vidi, vici.
- peddling-brink 3y agoSo <i> will give my screen reader an Italian accent?
- crooked-v 3y agoThat's where the classic nickname 'Mario tags' came from.
- jes5199 3y agothis an ancient debate, but in practice there is no difference
- lolinder 3y agoMy sense is that the more complicated explanation that OP found is just retconning, trying to explain away the fact that someone in the committee didn't like <b> and <i> but couldn't get anyone else on board with deprecating them. In practice, any sane screen reader or default visual style will treat them exactly the same.
- dsego 3y agoLol, in modern react apps sometimes I find <span style={{fontWeight: 'bold'}}> or even better some made up "component" like <Box> or <Typography>. Then there is styled components like bold = styled.span`font-weight: bold`. It's amusing.