Home  >  Article  >  Web Front-end  >  How to write html underline code

How to write html underline code

下次还敢
下次还敢Original
2024-04-21 13:33:161259browse

There are two ways to create underline code in HTML: use tags to wrap the text and use CSS to control the style, defined by text-decoration: underline, and then apply the CSS class on the text

How to write html underline code

HTML underline code

There are two ways to create underline code in HTML:

Method 1 : Use the tag

This method is the simplest, just use the tag to wrap the text:

<code class="html"><u>这是下划线文本</u></code>

Method 2: Use CSS

Use CSS to more flexibly control the underline style, such as thickness and color:

<code class="css">.underlined {
  text-decoration: underline;
}</code>

Then apply this CSS class on the text you want to underline:

<code class="html"><p class="underlined">这是下划线文本</p></code>

The above is the detailed content of How to write html underline code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn