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 tcpdump command examples in Linux

Preface To put it simply, tcpdump is a packet ana...

Implementation of Nginx forwarding matching rules

1. Regular expression matching ~ for case-sensiti...

Detailed explanation of Linux tee command usage

The tee command is mainly used to output to stand...

Writing High-Quality Code Web Front-End Development Practice Book Excerpts

(P4) Web standards are composed of a series of sta...

How to use the WeChat Mini Program lottery component

It is provided in the form of WeChat components. ...

Implementing a simple web clock with JavaScript

Use JavaScript to implement a web page clock. The...

CSS text alignment implementation code

When making forms, we often encounter the situati...

Explanation of the precautions for Mysql master-slave replication

1. Error error connecting to master 'x@xxxx:x...

Transplanting the mkfs.vfat command in busybox under Linux system

In order to extend the disk life for storing audi...

You may not know these things about Mysql auto-increment id

Introduction: When using MySQL to create a table,...

Steps to completely uninstall the docker image

1. docker ps -a view the running image process [r...

How to change the system language of centos7 to simplified Chinese

illustrate When you install the system yourself, ...

Pagination Examples and Good Practices

<br />Structure and hierarchy reduce complex...

Simple web design concept color matching

(I) Basic concepts of web page color matching (1) ...