The HTML header contains information about the page.The content in the header information is mainly used by the browser and will not be displayed in the body content of the web page.
In addition, search engines such as Google, Yahoo, Baidu, etc. will also search the head information in the webpage.In order to enable search engines to include web pages, appropriate head information should also be filled in (see the chapter "Search Engine Optimization Strategies" for details).
(1)title
The title is the most commonly used head information.It does not appear in HTMLWebsite productionThe text is displayed in the title bar of the browser window.For example, the display effect of the following code is shown in Figure 5-15.
<head><title>Welcome to my website</title></header>
(2)link
Link can be used to establish links with external files.Commonly used is the link to CSS external style sheet.The example code is as follows:
The<body>of HTML has two attributes about the background. One is bgcolor, which sets the background color;The other is background, which is used to set the background image.
(1)bgcolor
The bgcolor attribute is used to set the background color of the HTML page.For example:
<html> <body bgcolor="yellow"> This page has a yellow background </body> </html>
(2)background
The background attribute is used to set the background image of the HTML page.The background attribute value is the path and file name of the background image. If the background image is smaller than the page display window, the background image will automatically repeat.
3. Text format
(1) Literal form
In HTML, you can use the identifier FONT and its attributes to set the size, font and color of text.The details are as follows:
<FONT SIZE="" FACE="n" COLOR="" ></FONT>
The commonly used attributes are: "SIZE", which determines the text size. n takes a number from 1 to 7, and the default value is 3;"FACE" determines the text font; "COLOR" determines the text color.
In addition to the FONT identifier that controls the basic form of text, there are other identifiers in HTML that can be used to control the text form, as shown in Table 5-3.
(2) Body Title
HTML uses<hl>to<h6>tags to define body titles, from large to small.Each body title is a paragraph.
(3) Paragraph division
Use<p>and</p>to divide paragraphs in HTML.
(4) Text Wrap
By using the<hr>identifier, you can wrap lines without creating new paragraphs<Br>The difference between<br>and<p>is that the branch of<br>is to restart a line, while the segment of<p>is to restart a line after an empty line.
(5) Character entity
Some characters have special meanings in HTM L. For example, the less than sign "<" indicates the beginning of an HTML tag. The less than sign is not displayed in the final page.If you want to display a less than sign in the web page, you need to use HTML Character Entities.For example, in general, HTM L will automatically truncate extra spaces.No matter how many spaces are added, they are regarded as one space.If you add 10 spaces between two words, HTML will truncate 9 spaces, leaving only one.In order to add spaces in the web page, you can use Represents a space.
A character entity is divided into three parts: the first part is an ampersand;The second part is the entity name or # plus the entity number;The third part is a semicolon.For example, to display the less than sign, you can write&It;Or&# 60;.The advantage of using entity names is easy to understand, but its disadvantage is that not all browsers support the latest entity names.The entity number can be processed by all kinds of browsers.
Note: Entity is case sensitive.
4. Multimedia
HTML files can contain pictures, audio, video and other multimedia information formats, which greatly facilitates the spread of network information.
(1) Picture
Use the<img>identifier to insert pictures into HTML.The basic syntax is as follows:
<img src="url">
Url indicates the path and file name of the image.
<img>has an alt attribute (alternate text).An example sentence is as follows:
If the browser does not have the function of carrying people, it will display the value of alt attribute instead.In fact, most browsers now support picture carrying.The alt attribute is introduced here because of its other important function.At present, search engine crawling tools cannot recognize the text contained in the image, so the alt attribute is used to write a description of the image to facilitate the search engine to crawl the content of the web page.
By default, the image displays the original size, but you can use the height and width attributes to change the size of the image
Property is set to Autostart=false - the sound will not play automatically when the web page is opened.
② Add sound link
<A HREF="soundURL">Music file name</a>
③ Add web background music
<bgsound SRC="soundURL">
The attribute is set to LOOP=N (number of plays)/- 1 to open the web page, and the sound will play in cycles. N is the number of cycles, and - 1 is infinite.
(3) Video
① Web page embedded video
<EMBED SRC="Video File Location">
Common attributes include: WIDTH, HEIGHT, AUTOSTART, LOOP.
② Add video link
<A HREF="videoURL">Video file name</A>
5. Hyperlink Stop
(1) A and href attributes
HTML uses<a>to represent hyperlinks (anchors)<a> It can point to any file source: an HTML page, an image, a movie file, etc.The usage is as follows:
<a href="url">Linked display text</a>
Click the content in<a></a>to open a linked file. The h ref attribute indicates the path of the linked file.For example, if you link to the homepage of Luoyang Institute of Technology website, you can say:
<a href="//ihucc.com">Shangpin China</a>
(2) Name attribute
Using the name attribute, you can jump to the specified part of a file.Use the name attribute to set a pair.One is to set the name of the name, and the other is to set an href to point to the name:
The name attribute is usually used to create a table of contents for a large file.A link is created for each chapter and placed at the beginning of the file. The name attribute is set at the beginning of each chapter.When the user clicks the link of a chapter, the content of the chapter will be displayed on the top.
(3) Link to E-mail address
On the website, you will often see links such as "Contact Us". Once you click this link, you will trigger the e-mail client of the browser, such as Outlook Express, and then a new e-mail window will be displayed.Such functions can be realized with<a>, for example:
Due to the limited space in this book, only basic knowledge in HTML can be briefly explained here. If learners are interested in further learning, they can refer to relevant books. This article was published onSEO website optimizationCompany Shangpin China//ihucc.com/