Home >Web Front-end >HTML Tutorial >Detailed explanation of examples of HTML text formatting

Detailed explanation of examples of HTML text formatting

php中世界最好的语言
php中世界最好的语言Original
2018-01-20 11:21:202166browse

This time I will bring you a detailed explanation of HTML text formatting examples. What are the precautions for HTML text formatting? Here are actual cases, let’s take a look.

1. Text formatting: This example demonstrates how to format text in an HTML file

<html>  
  
<body>  
  
<b>This text is bold</b>  
  
<br />  
  
<strong>This text is strong</strong>  
  
<br />  
  
<big>This text is big</big>  
  
<br />  
  
<em>This text is emphasized</em>  
  
<br />  
  
<i>This text is italic</i>  
  
<br />  
  
<small>This text is small</small>  
  
<br />  
  
This text contains   
<sub>subscript</sub>  
  
<br />  
  
This text contains   
<sup>superscript</sup>  
  
</body>  
</html>

2. Preformatted text: This example demonstrates how to use the pre tag to format empty lines and spaces for control.

<html>  
  
<body>  
  
<pre class="brush:php;toolbar:false">  
这是   
预格式文本。   
它保留了      空格   
和换行。   

pre 标签很适合显示计算机代码:

  
for i = 1 to 10   
     print i   
next i   

3. "Computer Output" label: This example demonstrates the display effects of different "Computer Output" labels.

<html>  
  
<body>  
  
<code>Computer code</code>  
<br />  
<kbd>Keyboard input</kbd>  
<br />  
<tt>Teletype text</tt>  
<br />  
<samp>Sample text</samp>  
<br />  
<var>Computer variable</var>  
<br />  
  
<p>  
<b>注释:</b>这些标签常用于显示计算机/编程代码。   
</p>  
  
</body>  
</html>

4. Address: This example demonstrates how to write an address in an HTML file.

<!DOCTYPE html>  
<html>  
<body>  
  
<address>  
Written by <a href="mailto:webmaster@example.com">Donald Duck</a>.<br>    
Visit us at:<br>  
Example.com<br>  
Box 564, Disneyland<br>  
USA   
</address>  
  
</body>  
</html>

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to the php Chinese website Other related articles!

Related reading:

What are the list tags in html?

HTML editing basics (a must-read for beginners)

htmlTitle, paragraph, line break, horizontal line, special How characters should be used

The above is the detailed content of Detailed explanation of examples of HTML text formatting. 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