Skip to content Skip to sidebar Skip to footer

Significant Individuals if in Bold Print

If you work exclusively in a content management system similar CMS Hub or WordPress, you're used to being able to bold, italicize, and underline text with a click of the button. But what if your toolbar doesn't offer the verbal formatting option you want? Or you're not working in a word processor or a CMS?

No trouble. All you need is some HTML and CSS. Below we'll discuss some use cases for formatting text. So, we'll walk through the process for creating bold, italicized, underlined, strikethrough, subscript, and superscript text.

Download Now: Free Intro Guide to HTML & CSS

When bolding text, it's considered a all-time practice to use the <strong> tag in favor of the <b> tag. This is because the <strong> a semantic chemical element whereas <b> is not. Non-semantic elements can make content localization and time to come proofing difficult, according to the HTML5 specification. Additionally, if the text bolding is purely stylistic, it'southward better to apply CSS and proceed all folio styling separate from the content.

For this reason, we'll only be showing examples using <strong> and the CSS font-weight property.

How to Bold Text in HTML with the Stiff Element

To define text with strong importance, identify the text inside <potent> tags. Let'southward look at an example.

Here's the HTML:

                                          

<p>This is some normal paragraph text, <strong>and this is some important text.</stiff></p>

Here's the effect:

example of how to bold text in html

How to Bold Text in HTML with the CSS Font-Weight Belongings

To assuming text just for ornamentation, use the CSS font-weight property instead of the HTML potent element. Let's say you want to bold a word in a paragraph — you'd wrap the word in <bridge> tags and use a CSS class selector to apply the font-weight belongings to the specific span chemical element only.

Hither's the CSS:

                                          

.bolded { font-weight: assuming; }

Here's the HTML:

                                          

<p>This is some normal paragraph text, and this <bridge class="bolded">word</bridge> is bold for ornament.</p>

Hither'due south the result:

example of how to bold text in html

Similar <strong> and <b>, the <em> tag is generally preferred over the <i> tag as information technology is a semantic element, then we'll exist using it in our HTML examples. For styling, stick with CSS and avoid the <i> tag.

How to Italicize Text in HTML with the Emphasis Element

To define text with stress emphasis, place the text inside <em> tags. Let's see an example.

Here'south the HTML:

                                          

<p>This is some normal paragraph text, <em>and this is some emphasized text.</em></p>

Here's the outcome:

example of how to add italics to text in html

How to Italicize Text in HTML with the CSS Font-Style Property

To italicize text for ornamentation, apply the CSS font-style property. Imagine you want to italicize a word within a paragraph. First, wrap the give-and-take in <span> tags, then apply the font-mode property to the bridge chemical element only.

Here's the CSS:

                                          

.emphasized { font-way: italic; }

Here's the HTML:

                                          

<p>This is some normal paragraph text, and this <span class="emphasized">give-and-take</bridge> is italicized for ornament.</p>

Here's the outcome:

example of how to add italics to text in html

You can also 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 similar marking up misspelled words, denoting proper names in Chinese text, or indicating family names.

Let's await at both methods below.

How to Underline Text in HTML with the Unarticulated Annotation Chemical element

If you lot'd like to display text that is unarticulated or has a not-textual note, place the text within <u> tags. For example:

                                          

<p>This <u>wrd</u> is misspelled, and so we've underlined it.</p>

Here's the result:

example of how to underline text in html

How to Underline Text in HTML with the CSS Text-Decoration Property

If yous'd like to underline text for ornamentation, rather than to represent a non-textual notation, then you'd use the CSS text-decoration holding, like so:

Here'southward the CSS:

                                          

.underlined {text-decoration: underline;}

Here'southward the HTML:

                                          

<p>This text is normal, and <span class="underlined"> this text is underlined</span>.</p>

And here's the result:

example of how to underline text in html and css

How to Return Strikethrough Text in HTML

There are multiple ways to render strikethrough text in HTML, which is text displayed with a horizontal line through information technology. You tin use the <southward> tag to indicate that the text is now wrong, inaccurate, or irrelevant. If you want to indicate text that has been deleted, use the <del> tag.

If you lot want to show the text as strikethrough for another reason, and then you'd use the CSS text-decoration-line property and set this holding to "line-through."

It'due south important to note that the HTML <strike> chemical element has been deprecated and is no longer a viable option for rendering strikethrough text.

Allow's look at examples for the iii methods supported in the current version of HTML.

How to Strikethrough Text in HTML with the Strikethrough Element

If you'd like to strikethrough text to show that it is no longer correct, accurate, or relevant, identify the text inside <s> tags. Let's look at an example.

Hither's the HTML:

                                          

<p>The meeting will begin at 5:00 PM on <s>Saturday</southward> now on Dominicus.</p>

Here's the result:

example of how to strikethrough text in html

How to Strikethrough Text in HTML with the Deleted Text Element

To strikethrough text to show that it has been deleted, identify the text within <del> tags. Permit'south come across an example with a list element:

Hither's the HTML:

                                          

<p>Appointments are now available for:</p>

<ul>

<li><del>iii PM</del></li>

<li><del>4 PM</del></li>

<li>5 PM</li>

</ul>

Here's the result:

example of how to strikethrough text in html

How to Strikethrough Text in HTML with the CSS Text-Ornamentation-Line Property

To strikethrough text for another purpose, use the CSS text-decoration-line property.

Here'south the CSS:

                                          

.strike { text-decoration-line: line-through; }

Here'southward the HTML:

                                          

<p>This text is normal, and <bridge class="strike"> this text is line-through</bridge>.</p>

Here'south the consequence:

example of how to strikethrough text in html and css

How to Brand Text Subscript in HTML

Usually rendered in a smaller but heavier font, subscript text appears half a grapheme below the normal line. Information technology tin be used in chemical formulas, math equations, fractions, and more.

To create subscript text in HTML, apply the <sub> element. See the example below.

Here's the HTML:

                                          

<p>The chemic formula for water is H<sub>2</sub>O.</p>

Here's the result:

example of how to write subscript text in html

How to Make Text Superscript in HTML

Ordinarily rendered in a smaller but heavier font, superscript text appears half a character above the normal line. It can be used to write footnotes, copyright, registered trademarks, and some chemical formulas too.

To create superscript text in HTML, utilise the <sup> element. See the instance beneath.

Hither'southward the HTML:

                                          

<p>Water is essential for all forms of life.<sup>1</sup></p>

Hither's the result:

example of how to write superscript text in html

Formatting Text with HTML & CSS

By formatting text in any of the means described above, you can help your readers to amend understand and retain information from your site. Whether you want to bold keywords or include subscript in chemical formulas, formatting text only requires bones knowledge of HTML and CSS.

Editor'southward note: This post was originally published in October 2020 and has been updated for comprehensiveness.

New Call-to-action

css introduction

Originally published Dec 10, 2021 7:00:00 AM, updated Dec 10 2021

moldenhauerheye1936.blogspot.com

Source: https://blog.hubspot.com/website/how-to-bold-in-html

Post a Comment for "Significant Individuals if in Bold Print"