Simple example of HTML text formatting (detailed explanation)

Simple example of HTML text formatting (detailed explanation)

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

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. < b > This text is bold </ b >   
  6.   
  7. < br   />   
  8.   
  9. < strong > This text is strong </ strong >   
  10.   
  11. < br   />   
  12.   
  13. < big > This text is big </ big >   
  14.   
  15. < br   />   
  16.   
  17. < em > This text is emphasized </ em >   
  18.   
  19. < br   />   
  20.   
  21. < i > This text is italic </ i >   
  22.   
  23. < br   />   
  24.   
  25. < small > This text is small </ small >   
  26.   
  27. < br   />   
  28.   
  29. This text contains
  30. < sub > subscript </ sub >   
  31.   
  32. < br   />   
  33.   
  34. This text contains
  35. < sup > superscript </ sup >   
  36.   
  37. </ body >   
  38. </ html >   

The effect is as follows:

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

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. < pre >   
  6. This is
  7. Preformatted text.
  8. It preserves spaces
  9. and line breaks.
  10. </ pre >   
  11.   
  12. The < p > pre tag is great for displaying computer code: </ p >   
  13.   
  14. < pre >   
  15. for i = 1 to 10
  16. print i
  17. next i
  18. </ pre >   
  19.   
  20. </ body >   
  21. </ html >   

The effect is as follows:

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

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. < code > Computer code </ code >   
  6. < br   />   
  7. < kbd > Keyboard input </ kbd >   
  8. < br   />   
  9. < tt > Teletype text </ tt >   
  10. < br   />   
  11. < samp > Sample text </ samp >   
  12. < br   />   
  13. < var > Computer variable </ var >   
  14. < br   />   
  15.   
  16. < p >   
  17. < b > Comment: </ b > These tags are often used to show computer/programming code.
  18. </ p >   
  19.   
  20. </ body >   
  21. </ html >   

The effect is as follows:

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

XML/HTML CodeCopy content to clipboard
  1. <!DOCTYPE html >   
  2. < html >   
  3. < body >   
  4.   
  5. < address >   
  6. Written by < a   href = "mailto:[email protected]" > Donald Duck </ a > . < br >     
  7. Visit us at: < br >   
  8. Example.com < br >   
  9. Box 564, Disneyland < br >   
  10. USA
  11. </ address >   
  12.   
  13. </ body >   
  14. </ html >   

The effect is as follows:

5. Abbreviations and acronyms: This example demonstrates how to implement abbreviations or acronyms.

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. < abbr   title = "etcetera" > etc. </ abbr >   
  6. < br   />   
  7. < acronym   title = "World Wide Web" > WWW </ acronym >   
  8.   
  9. < p > In some browsers, title can be used to display the full version of the expression when you move your mouse over the abbreviation. </ p >   
  10.   
  11. <p> Only works with acronym elements in IE 5 . </ p >   
  12.   
  13. < p > Valid for both the abbr and acronym elements in Netscape 6.2. </ p >   
  14.   
  15. </ body >   
  16. </ html >   

The effect is as follows:

6. Text direction: This example demonstrates how to change the direction of text.

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. < p >   
  6. If your browser supports bi-directional override (bdo), the next line will be output right to left (rtl);
  7. </ p >   
  8.   
  9. < bdo   dir = "rtl" >   
  10. Here is some Hebrew text
  11. </ bdo >   
  12.   
  13. </ body >   
  14. </ html >   

The effect is as follows:

7. Block quotations: This example demonstrates how to implement quotations of varying lengths.

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. Here is the long quote:
  6. < blockquote >   
  7. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote. This is a long quote.
  8. </ blockquote >   
  9.   
  10. Here is the short quote:
  11. < q >   
  12. This is a short quote.
  13. </ q >   
  14.   
  15. < p >   
  16. When using the blockquote element, the browser inserts line breaks and margins, while the q element does not have any special rendering.
  17. </ p >   
  18.   
  19. </ body >   
  20. </ html >   

The effect is as follows:

8. Delete sub-effects and insert sub-effects.

XML/HTML CodeCopy content to clipboard
  1. < html >   
  2.   
  3. < body >   
  4.   
  5. < p > There are < del > twenty </ del > in a dozen   < ins > twelve </ ins > pieces. </ p >   
  6.   
  7. < p > Most browsers will rewrite this to strikethrough and underline the text. </ p >   
  8.   
  9. < p > Some older browsers display struck-through and underlined text as normal text. </ p >   
  10.   
  11. </ body >   
  12. </ html >   

The effect is as follows:

The above simple example of HTML text formatting (detailed explanation) is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

<<:  Introduction to Apache deployment of https in cryptography

>>:  Three ways to create a gray effect on website images

Recommend

Installing MySQL 8.0.12 based on Windows

This tutorial is only applicable to Windows syste...

MySQL database aggregate query and union query operations

Table of contents 1. Insert the queried results 2...

How to remount the data disk after initializing the system disk in Linux

Remount the data disk after initializing the syst...

Implementation of one-click TLS encryption for docker remote api

Table of contents 1. Change the 2375 port of Dock...

Improvements to the web server to improve website performance

<br />In the first section of this series, w...

4 functions implemented by the transform attribute in CSS3

In CSS3, the transform function can be used to im...

Write a simple calculator using JavaScript

The effect is as follows:Reference Program: <!...

The whole process record of vue3 recursive component encapsulation

Table of contents Preface 1. Recursive components...

Native JS to implement login box email prompt

This article shares a native JS implementation of...

Linux disk sequential writing and random writing methods

1. Introduction ● Random writing will cause the h...

Detailed steps for QT to connect to MYSQL database

The first step is to add the corresponding databa...

Steps to use autoconf to generate Makefile and compile the project

Preface Under Linux, compilation and linking requ...

Detailed explanation of the use of this.$set in Vue

Table of contents Use of this.$set in Vue use Why...

mysql5.6.8 source code installation process

Kernel: [root@opop ~]# cat /etc/centos-release Ce...