{"id":376548,"date":"2023-02-06T07:06:55","date_gmt":"2023-02-06T15:06:55","guid":{"rendered":"https:\/\/css-tricks.com\/?p=376548"},"modified":"2023-02-06T07:06:57","modified_gmt":"2023-02-06T15:06:57","slug":"the-double-emphasis-thing","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/the-double-emphasis-thing\/","title":{"rendered":"The Double Emphasis Thing"},"content":{"rendered":"\n
I used to have this boss who loved<\/em>, loved<\/strong>, loved<\/em><\/strong>, loved<\/span><\/em><\/strong> to emphasize words. This was way back before we used a WYSIWYG editors and I’d have to handcode that crap.<\/p>\n\n\n\n (Let’s not go into the colors he used for even MOAR<\/strong><\/span> emphasis.)<\/p>\n\n\n\n Writing all that markup never felt great. The effort it took, sure, whatever. But is it even a good idea to add overload content with double \u2014 or more! \u2014 emphases?<\/p>\n\n\n\n\n\n\n For starters, the So, Warning:<\/strong> The following content has been flagged for being awesome.<\/p>\n<\/blockquote>\n\n\n\n It might be tempting to reach for Both examples stress emphasis, but on different words. And they would sound different if you were to read them out loud. That makes Those are two things you gotta weigh when emphasizing content. Like, there are plenty of instances where you may need to italicize content without affecting the meaning of the sentence. But those can be handled with other tags that render italics:<\/p>\n\n\n\n It’s going to he the same thing with There are legitimate cases where you may need to italicize part of a line that’s already emphasized. Or maybe add emphasis to a bit of text that’s already italicized.<\/p>\n\n\n\n A blockquote might be a good example. I’ve seen plenty of times where they are italicized for style, even though default browser styles don’t do it:<\/p>\n\n\n\n What if we need to mention a movie title in that blockquote? That should be italicized. There’s no stress emphasis needed, so an In a situation where we’re italicizing something within italicized content like this, we’re supposed to remove the italics<\/em> from the nested element… Container style queries<\/a> will be super useful to nab all these instances if we get them:<\/p>\n\n\n\n This little snippet evaluates the blockquote to see if it’s I wouldn’t nest …or nest The rendering is fine! And it doesn’t matter what order they’re in… at least in modern browsers. Jennifer Kyrnin mentions that some browsers only render the tag nearest to the text<\/a>, but I didn’t bump into that anywhere in my limited tests. But something to watch for!<\/p>\n\n\n\n The reason I wouldn’t nest one form of emphasis in another is because it simply isn’t needed. There is no grammar rule that calls for it. Like exclamation points, one form of emphasis is enough, and you ought to use the one that matches what you’re after whether it’s visual, weight, or announced emphasis.<\/p>\n\n\n\n And even though some screen readers are capable of announcing emphasized content, they won’t read the markup with any additional importance or emphasis. So, no additional accessibility perks either, as far as I can tell.<\/p>\n\n\n If you’re in the position where your boss is like mine and wants ALL the<\/span><\/em> emphasis<\/strong>, I’d reach for the right HTML tag for the type of emphasis, then apply the rest of the styles with a mix of tags that don’t affect semantics with CSS to help account for anything browser styles won’t handle.<\/p>\n\n\n\n I might even do it with the As long as we’re playing defense, we can identify errors where emphases are nested within emphases by highlighting them in red or something:<\/p>\n\n\n\n Then I’d probably use that snippet from the last section that removes the default italic styling from an element when it is nested in another italiczed element.<\/p>\n\n\n Mayyyyybe:<\/p>\n\n\n\n I used to have this boss who loved, loved, loved, loved to emphasize words. This was way back before we used a WYSIWYG editors and I’d have to handcode that crap. (Let’s not go into the colors he used for even MOAR emphasis.) Writing all that markup never felt great. The effort it took, sure, […]<\/p>\n","protected":false},"author":2508,"featured_media":376565,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"The Double Emphasis Thing by @geoffreygraham","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[4],"tags":[16956,16955,731],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/double-emphasis.jpg?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":5876,"url":"https:\/\/css-tricks.com\/poll-results-puncation\/","url_meta":{"origin":376548,"position":0},"title":"Poll Results: Punctuation Inside or Out?","date":"March 11, 2010","format":false,"excerpt":"Quite a lot of people weighed in on this poll that went out in January. The question was: Should tags like em and strong go (outside)<\/em> punctuation characters, or (inside them<\/strong>)? Like many polls around here, the question was interesting and stirred up some great conversation, but the question itself\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":278204,"url":"https:\/\/css-tricks.com\/emphasizing-emphasis\/","url_meta":{"origin":376548,"position":1},"title":"Emphasizing Emphasis","date":"October 30, 2018","format":false,"excerpt":"I think Facundo Corradini is right here in calling out our tweet. If you're italicizing text because it should be styled that way (e.g. using italics to display a person's internal thought dialog, as illustrated in our example), then that's an and not an , because is for stress emphasis\u2026","rel":"","context":"In "Link"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/10\/emphasizing-em.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":5346,"url":"https:\/\/css-tricks.com\/new-poll-tagpunctuation-placement\/","url_meta":{"origin":376548,"position":2},"title":"New Poll: Tag\/Punctuation Placement","date":"January 21, 2010","format":false,"excerpt":"There is probably a right and wrong answer for this, so if that emerges, I'll update this article and mention it in the results. Regardless, I don't think it's obvious, so this poll should be answered on what you currently actually do, not the \"correct\" answer. Should special marks in\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":316116,"url":"https:\/\/css-tricks.com\/how-to-italicize-text\/","url_meta":{"origin":376548,"position":3},"title":"How to Italicize Text","date":"July 17, 2020","format":false,"excerpt":"HTML and CSS offer us the ability to italicize text. I\u2019m talking about text like this. Let\u2019s cover everything you\u2019ll need to know. What is italic text and why would you italicize text? You italicize text most often to call attention to it. Literally to emphasize a word, so that\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/07\/italic.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":324942,"url":"https:\/\/css-tricks.com\/this-page-is-a-truly-naked-brutalist-html-quine\/","url_meta":{"origin":376548,"position":4},"title":"This page is a truly naked, brutalist html quine.","date":"November 4, 2020","format":false,"excerpt":"Here's a fun page coming from secretGeek.net. You don't normally think \"fun\" with brutalist minimalism but the CSS trickery that makes it work on this page is certainly that. The HTML is literally displayed on the page as tags. So, in a sense, the HTML is both the page markup\u2026","rel":"","context":"In "Link"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/10\/brutalist-html-quine.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1188,"url":"https:\/\/css-tricks.com\/what-do-you-think-is-the-best-online-wysiwyg-editor\/","url_meta":{"origin":376548,"position":5},"title":"What Do You Think is the Best Online WYSIWYG Editor?","date":"October 13, 2008","format":false,"excerpt":"This question was sent in by Edwin. To clarify, I believe Edwin is asking about these JavaScript scripts you can use on website which turn regular <p>\n I used to have this boss who <em>loved<\/em>, <strong>loved<\/strong>, \n <strong><em>loved<\/em><\/strong>, <strong><em><u>loved<\/u><\/em><\/strong> \n to emphasize words.\n<\/p><\/code><\/pre>\n\n\n\n
Different tags convey different emphasis<\/h3>\n\n\n
<strong><\/code> and
<em><\/code> tags are designed for different uses. We got them back in HTML5, where:<\/p>\n\n\n\n
\n
<strong><\/code>:<\/strong> Is used to convey “strong importance, seriousness, or urgency for its contents”<\/a>.<\/li>\n\n\n\n
<em><\/code>:<\/strong> Represents “stress emphasis”<\/a>.<\/li>\n<\/ul>\n\n\n\n
<strong><\/code> gives the content more weight in the sense it suggests that the content in it is important or urgent. Think of a warning:<\/p>\n\n\n\n
\n
<em><\/code> to do the same thing. Italicized text can be attention-grabbing after all. But it’s really meant as a hint to use more emphasis when readingt the content in it. For example, here are two versions of the same sentence with the emphasis in different locations:<\/p>\n\n\n\n
<p>I ate the <em>entire<\/em> plate of burritos.<\/p>\n<p>I ate the entire <em>plate<\/em> of burritos.<\/p><\/code><\/pre>\n\n\n\n
<em><\/code> a great way to express tone in your writing. It changes the meaning of the sentence in a way that
<strong><\/code> does not.<\/p>\n\n\n
Visual emphasis vs. semantic emphasis<\/h3>\n\n\n
\n
<i><\/code>:<\/strong> This is the classic one! Before HTML5, this was used to stress emphasis with italics all over the place. Now, it’s purely used to italicize content visually without changing the semantic meaning.<\/li>\n\n\n\n
<cite><\/code>:<\/strong> Indicating the source of a fact or figure. (“Source: CSS-Tricks<\/cite>“)<\/li>\n\n\n\n
<address><\/strong><\/code>: Used to mark up contact information, not only physical addresses, but things like email addresses and phone numbers too. (howdy@example.com<\/address>)<\/li>\n<\/ul>\n\n\n\n
<strong><\/code>. Rather than using it for styling text you want to look heavier, it’s a better idea to use the classic
<b><\/code> tag for boldfacing to avoid giving extra signficance to content that doesn’t need it. And remember, some elements like headings are already rendered in bold, thanks to the browser’s default styles. There’s no need to add even more strong emphasis.<\/p>\n\n\n
Using italics in emphasized content (and vice versa)<\/h3>\n\n\n
blockquote {\n font-style: italic;\n}<\/code><\/pre>\n\n\n\n
<i><\/code> tag will do. But it’s still weird to italicize something when it’s already rendered that way:<\/p>\n\n\n\n
<blockquote>\n This movie\u2019s opening weekend performance offers some insight in\n to its box office momentum as it fights to justify its enormous \n budget. In its first weekend, <i>Avatar: The Way of Water<\/i> made \n $134 million in North America alone and $435 million globally.\n<\/blockquote><\/code><\/pre>\n\n\n\n
<i><\/code> in this case.<\/p>\n\n\n\n
blockquote i {\n font-style: normal;\n}<\/code><\/pre>\n\n\n\n
blockquote {\n container-name: quote;\n font-style: italic;\n}\n\n@container quote (font-style: italic) {\n em, i, cite, address {\n font-style: normal;\n }\n}<\/code><\/pre>\n\n\n\n
font-style<\/code> is set to
italic<\/code>. If it is, then it’ll make sure the
<em><\/code>,
<i><\/code>,
<cite><\/code>, and
<address><\/code> elements are rendered as normal text, while retaining the semantic meaning if there is one.<\/p>\n\n\n
But back to emphasis within emphasis<\/h3>\n\n\n
<strong><\/code> inside
<em><\/code> like this:<\/p>\n\n\n\n
<p>I ate the <em><strong>entire<\/strong><\/em> plate of burritos.<\/p><\/code><\/pre>\n\n\n\n
<em><\/code> inside
<strong><\/code> instead:<\/p>\n\n\n\n
<p>I ate the <em><strong>entire<\/strong><\/em> plate of burritos.<\/p><\/code><\/pre>\n\n\n\n
But I really want all the emphasis!<\/h3>\n\n\n
<style>\n \/* If `em` contains `b` or `u` tags *\/\n em:has(b, u) {\n color: #f8a100;\n }\n<\/style>\n\n<p>\n I used to have this boss who <em>loved<\/em>, <strong>loved<\/strong>, \n <strong><em>loved<\/em><\/strong>, <strong><em><u>loved<\/u><\/em><\/strong> \n to emphasize words.\n<\/p><\/code><\/pre>\n\n\n\n
<strong><\/code> tag too as a defensive measure:<\/p>\n\n\n\n
\/* If `em` contains `b` or `u` tags *\/\nem:has(b, u),\n\/* If `strong` contains `em` or `u` tags *\/\nstrong:has(i, u) {\n color: #f8a100;\n}<\/code><\/pre>\n\n\n\n
\/* Highlight semantic emphases within semantic emphases *\/\nem:has(strong),\nstrong:has(em) {\n background: hsl(0deg 50% 50% \/ .25);\n border: 1px dashed hsl(0deg 50% 50% \/ .25);\n}<\/code><\/pre>\n\n\n\n
Anything else?<\/h3>\n\n\n
\n
<strong><\/code> in
<em><\/code> or the other way around, there may be a browser or several that will.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"