What Css Property Is Used to Bold Text
If you work exclusively in a content direction organization like CMS Hub or WordPress, you're used to being able to bold, italicize, and underline text with a click of the push. But what if your toolbar doesn't offer the exact formatting option y'all want? Or you're not working in a give-and-take processor or a CMS? No problem. All y'all need is some HTML and CSS. Below we'll talk over some use cases for formatting text. Then, nosotros'll walk through the process for creating assuming, italicized, underlined, strikethrough, subscript, and superscript text. To assuming the text in HTML, utilize either the strong tag or the b (bold) tag. Browsers will bold the text within both of these tags the same, just the strong tag indicates that the text is of particular importance or urgency. You can also bold text with the CSS font-weight holding ready to "bold." When bolding text, information technology's considered a best exercise to use the <stiff> tag in favor of the <b> tag. This is because the <potent> a semantic element whereas <b> is not. Non-semantic elements can make content localization and future proofing difficult, according to the HTML5 specification. Additionally, if the text bolding is purely stylistic, it'south ameliorate to use CSS and keep all folio styling separate from the content. For this reason, nosotros'll only be showing examples using <strong> and the CSS font-weight property. To define text with potent importance, identify the text inside <potent> tags. Let'due south wait at an example. Here'south the HTML: <p>This is some normal paragraph text, <potent>and this is some important text.</potent></p> Here'due south the result: To bold text but for ornamentation, use the CSS font-weight belongings instead of the HTML strong chemical element. Allow's say yous desire to assuming a word in a paragraph — you'd wrap the discussion in <bridge> tags and employ a CSS class selector to apply the font-weight holding to the specific bridge element only. Hither's the CSS: .bolded { font-weight: bold; } Here'due south the HTML: <p>This is some normal paragraph text, and this <span class="bolded">word</bridge> is bold for decoration.</p> Here'southward the event: To italicize the text in HTML, utilize either the em tag or the i (italics) tag. Both of these tags will italicize the text, but the em tag additionally indicates that the text has stress accent when read. You can too italicize text with the CSS font-style property ready to "italic." Similar <strong> and <b>, the <em> tag is generally preferred over the <i> tag as it is a semantic element, and so we'll be using it in our HTML examples. For styling, stick with CSS and avoid the <i> tag. To define text with stress accent, identify the text within <em> tags. Let'due south encounter an case. Hither'south the HTML: <p>This is some normal paragraph text, <em>and this is some emphasized text.</em></p> Here's the issue: To italicize text for decoration, use the CSS font-way belongings. Imagine you want to italicize a word inside a paragraph. Get-go, wrap the word in <span> tags, then apply the font-fashion holding to the span element only. Here's the CSS: .emphasized { font-style: italic; } Here's the HTML: <p>This is some normal paragraph text, and this <span class="emphasized">word</span> is italicized for decoration.</p> Here's the result: To underline text in HTML and CSS, use the CSS text-decoration belongings, set up to "underline." Yous tin can besides underline text with the <u> element, but this should not be used to underline text for presentation purposes. The <u> element is meant for specific use cases like marking up misspelled words, denoting proper names in Chinese text, or indicating family names. Let's look at both methods below. If you lot'd like to display text that is unarticulated or has a non-textual annotation, place the text inside <u> tags. For example: <p>This <u>wrd</u> is misspelled, so nosotros've underlined it.</p> Here's the result: If you'd like to underline text for ornament, rather than to stand for a non-textual annotation, so you'd utilise the CSS text-ornamentation holding, similar so: Here'due south the CSS: .underlined {text-ornamentation: underline;} Here's the HTML: <p>This text is normal, and <bridge course="underlined"> this text is underlined</span>.</p> And here's the result: In that location are multiple means to return strikethrough text in HTML, which is text displayed with a horizontal line through it. You can use the <s> tag to bespeak that the text is now incorrect, inaccurate, or irrelevant. If you desire to indicate text that has been deleted, use the <del> tag. If you want to evidence the text equally strikethrough for another reason, then y'all'd use the CSS text-decoration-line property and prepare this property to "line-through." Information technology's important to note that the HTML <strike> element has been deprecated and is no longer a viable choice for rendering strikethrough text. Let's look at examples for the 3 methods supported in the current version of HTML. If yous'd like to strikethrough text to show that information technology is no longer correct, accurate, or relevant, place the text inside <s> tags. Allow's look at an example. Hither'southward the HTML: <p>The meeting will brainstorm at 5:00 PM on <s>Saturday</southward> now on Dominicus.</p> Here's the result: To strikethrough text to show that information technology has been deleted, identify the text within <del> tags. Let's see an instance with a list element: Here'south the HTML: <p>Appointments are at present bachelor for:</p> <ul> <li><del>iii PM</del></li> <li><del>4 PM</del></li> <li>5 PM</li> </ul> Here's the result: To strikethrough text for another purpose, use the CSS text-decoration-line property. Here's the CSS: .strike { text-decoration-line: line-through; } Here's the HTML: <p>This text is normal, and <span course="strike"> this text is line-through</span>.</p> Here's the result: Normally rendered in a smaller simply heavier font, subscript text appears one-half a grapheme below the normal line. It can be used in chemical formulas, math equations, fractions, and more. To create subscript text in HTML, use the <sub> element. See the example below. Here's the HTML: <p>The chemical formula for h2o is H<sub>2</sub>O.</p> Hither'due south the event: Usually rendered in a smaller merely heavier font, superscript text appears one-half a grapheme above the normal line. Information technology can exist used to write footnotes, copyright, registered trademarks, and some chemic formulas every bit well. To create superscript text in HTML, use the <sup> element. Encounter the example beneath. Here's the HTML: <p>Water is essential for all forms of life.<sup>1</sup></p> Hither'south the issue: Past formatting text in whatsoever of the ways described above, you lot can help your readers to amend understand and retain data from your site. Whether you desire to bold keywords or include subscript in chemical formulas, formatting text just requires basic cognition of HTML and CSS. Editor'south note: This post was originally published in Oct 2020 and has been updated for comprehensiveness.
How to Assuming Text in HTML
How to Bold Text in HTML with the Strong Element
How to Bold Text in HTML with the CSS Font-Weight Property
How to Italicize Text in HTML
How to Italicize Text in HTML with the Emphasis Element
How to Italicize Text in HTML with the CSS Font-Way Property
How to Underline Text in HTML
How to Underline Text in HTML with the Unarticulated Notation Element
How to Underline Text in HTML with the CSS Text-Ornamentation Property
How to Render Strikethrough Text in HTML
How to Strikethrough Text in HTML with the Strikethrough Element
How to Strikethrough Text in HTML with the Deleted Text Element
How to Strikethrough Text in HTML with the CSS Text-Decoration-Line Holding
How to Make Text Subscript in HTML
How to Brand Text Superscript in HTML
Formatting Text with HTML & CSS
Originally published Dec 10, 2021 7:00:00 AM, updated March 16 2022
blackshearreckeddens.blogspot.com
Source: https://blog.hubspot.com/website/how-to-bold-in-html
Post a Comment for "What Css Property Is Used to Bold Text"