XHTML introductory tutorial: text formatting and special characters

XHTML introductory tutorial: text formatting and special characters
<br />This section introduces how to implement text formatting and special characters in XHTML. We have used the <b> tag once in the previous tutorial to format text. It makes the content contained in it bold. For example, "<b>Rookie Bar</b>" will be displayed as Rookie Bar . We call this tag that defines how text is displayed a text format tag (text style tag...). Similar to the bold tag <b> are the italic tag <i> and the emphasis tag <em>. We recommend that you use CSS to define the style of a web page instead of XHTML tags like <b>. The purpose of introducing these tags here is to prevent you from being confused when reading the source code of other people's web pages. Special characters (character entities)
In XHTML, "<" and ">" are special characters because they are used to identify tags, and the "<" and ">" in tags do not appear on the page. So what should we do if we want the browser to display these special characters? At this time we can use character entities, for example, the less than sign "<" is written as "&lt;" in XHTML code. Of course, in web design software, this work does not require us to write code by hand. Therefore, we only need to understand the display principles of these special characters, and there is no need to remember the writing code of each special character. Practice Example Use Notepad to open the "index.html" file created previously. Make the following changes to the source file (in red), save it and see the difference before and after. Please make sure that your web page is the same as this page.
Writing homework for winter and summer vacations (math <b> can't guarantee </b> that there are no mistakes, Chinese can't guarantee that there are no typos, you can ask someone else to write English homework)
<br />If you help bully students in grade 4 or below, <b> additional fees will be charged </b> .
<br />The Parent Association will help <i> impersonate parents </i> .
</p><!--The above content is a paragraph-->
Let's practice using character entities. Open the previously saved "index.html" and enter the following code before the </body> tag: <p>Copyright&copy;2005-2006cainiao8.com All rights reserved</p>
Save the changes and re-browse the web page to see the following content:
"Copyright©2005-2006XXX Copyright No." We noticed that the “&copy” in the source code is displayed as “@” in the browser. Please double-check that your web page is the same as this one, done. About the order of tags After learning about text formatting tags, you may wonder, what should I do if I want a word to be displayed in bold and italics at the same time? Is it as simple as adding double tags <b> and <i> to it? That's right. Take a look at the following example:
<b><i>I am surrounded by two labels! </i></b>
It will appear in the browser as me being surrounded by two tags!
The only thing you need to pay attention to here is the order of the tags. If you write the above tag order as <b><i>I am surrounded by two tags! </b></i>, general browsers will not generate any errors. But this is not in compliance with XHTML standards. Please make sure to close the tags in order.

<<:  How to use Docker to package and deploy images locally

>>:  Some things to note about varchar type in Mysql

Recommend

Detailed explanation of how to find the location of the nginx configuration file

How can you find the location of the configuratio...

Using Apache ab to perform http performance testing

Mac comes with Apache environment Open Terminal a...

How to query the minimum available id value in the Mysql table

Today, when I was looking at the laboratory proje...

In-depth understanding of slot-scope in Vue (suitable for beginners)

There are already many articles about slot-scope ...

The new version of Chrome browser settings allows cross-domain implementation

Preface Currently, the front-end solves cross-dom...

Example of usage of keep-alive component in Vue

Problem description (what is keep-alive) keep-ali...

Analysis of the principle of using PDO to prevent SQL injection

Preface This article uses pdo's preprocessing...

Implementation of CSS circular hollowing (coupon background image)

This article mainly introduces CSS circular hollo...

Causes and solutions for cross-domain issues in Ajax requests

Table of contents 1. How is cross-domain formed? ...

JavaScript static scope and dynamic scope explained with examples

Table of contents Preface Static scope vs. dynami...

How to strike a balance between ease of use and security in the login interface

Whether you are a web designer or a UI designer, ...

How to use dd command in Linux without destroying the disk

Whether you're trying to salvage data from a ...

A brief discussion on using virtual lists to optimize tables in el-table

Table of contents Preface Solution Specific imple...

In IIS 7.5, HTML supports the include function like SHTML (add module mapping)

When I first started, I found a lot of errors. In...