in HTML by
Q:
How to underline a text in HTML? and what is the Use of Underline in HTML

1 Answer

0 votes
by
How to underline a text in HTML?

To underline a text in HTML, use the <u> tag. The <u> tag deprecated in HTML, but then re-introduced in HTML5. Now it represents a text different from another text stylistically, such as a misspelled word.

To underline a text, you can also use the style attribute. The style attribute specifies an inline style for an element. The attribute can be used with the HTML <p> tag, with the CSS property text-decoration.

Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.

Example

You can try the following code to underline text in an HTML page, using the <u> tag

Live Demo

<!DOCTYPE html>

<html>

   <head>

      <title>HTML u tag</title>

   </head>

   <body>

      <h1>Heading</h1>

      <p><u>This text will be underlined.</u></p>

   </body>

</html>

Example

You can try the following code to underline text in an HTML page, using the CSS text-decoration property

Live Demo

<!DOCTYPE html>

<html>

   <head>

      <title>HTML Text underline</title>

   </head>

   <body>

      <h1>Heading</h1>

      <p style="text-decoration: underline;">This text will be underlined.</p>

   </body>

</html>
Click here to read more about HTML
Click here to read more about Insurance

Related questions

+1 vote
asked Jan 28 in HTML by SakshiSharma
+1 vote
asked Jan 28 in HTML by SakshiSharma
0 votes
asked Oct 24, 2019 in HTML by SakshiSharma
0 votes
asked Jan 28 in HTML by SakshiSharma
0 votes
asked Jan 29 in HTML by rajeshsharma
...