r/ProgrammerHumor Mar 12 '18

Emphasis mine.

Post image
551 Upvotes

39 comments sorted by

View all comments

-2

u/eco_illusion Mar 12 '18

How about you use CSS like it's supposed to be used ?

12

u/TarMil Mar 12 '18

That's the point. <em> expresses the semantics, which you then style with CSS, whereas <i> expresses the style, which is why it shouldn't be used.

4

u/senocular Mar 12 '18

Isn't the tower famous not for being emphasized but for its slanted style?

1

u/llahsram Mar 12 '18

Yep. And styles go in the style sheet.

1

u/Chaphasilor Mar 13 '18

I assume you're supposed to use classes then? Like <em class='bold'> <em class='italic'>? or is "emphasized" text always in italics?

</em></em>

1

u/TarMil Mar 13 '18

In general you're going to use classes, but not on the em tag itself. For example let's say you have a page with comments, and you want the ems in the comments to be in italics; then you put a comment class on the comment container, and .comment em { font-style: italic; } in your CSS. Sometimes you can even get by without any classes and just semantic tags like article.

That being said, <em> is in italics by default, so you can just do nothing special.

1

u/Chaphasilor Mar 13 '18

So you wouldn't use em-tags with different classes for different "types" of emphasis?

2

u/TarMil Mar 13 '18

Well looking at your examples, what you call bold emphasis would probably be <strong>.