<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 "<" 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©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 “©” 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
I am currently learning MySQL. I am a complete no...
Grammatical rules SELECT column_name(s) FROM tabl...
HTML beginners often encounter the problem of how ...
Around version 0.6, privileged was introduced to ...
Table of contents 1. redo log (transaction log of...
When we are writing projects, we often encounter ...
Table of contents 1. Download nodejs 2. Double-cl...
Some projects have relatively simple business, bu...
By default, PHP on CentOS 7 runs as apache or nob...
Table of contents 1. Experimental Environment 2. ...
This article shares the specific code of the vue3...
This article is from the Apache Spark Meetup held...
This article uses examples to explain the princip...
Table of contents Preface What is Hot Change Coco...
Preface During the interview, many interviewers m...