How To Add Text In HTML

Adding text to our HTML page is simple using an element opened with the tag <p> which creates a new paragraph. We place all of our regular text inside the element <p>.

When we write text in HTML, we also have a number of other elements we can use to control the text or make it appear in a certain way.

Other Key Elements

They are as follows:

ElementMeaningPurpose
<b>BoldHighlight important information
<strong>StrongSimilarly to bold, to highlight key text
<i>ItalicTo denote text
<em>Emphasised TextUsually used as image captions
<mark>Marked TextHighlight the background of the text
<small>Small TextTo shrink the text
<strike>Striked Out TextTo place a horizontal line across the text
<u>Underlined TextUsed for links or text highlights
<ins>Inserted TextDisplayed with an underline to show an inserted text
<sub>Subscript TextTypographical stylistic choice
<sup>Superscript TextAnother typographical presentation style

These tags must be opened and closed around the text in question.

Let’s try it out. On a new line in the HTML editor, type the following HTML code:

<p>Welcome to <em>my</em> brand new website. This site will be my <strong>new<strong> home on the web.</p>

Don’t forget to hit save and then refresh the page in your browser to see the results.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *