Network editing required manual 2: HTML language Daquan

Source: Internet
Author: User
Tags file info
Document directory
  • File reference in the same directory
  • How to represent the parent directory
  •  
  • How to represent a sub-directory

HTML Special Character Display

Character entities)

Some characters have special meanings in HTML. For example, a character smaller than sign <indicates the beginning of an HTML Tag. This character smaller than sign is not displayed on the webpage we finally see. What should we do if we want to display a nickname in the webpage?

This is about html character entities.

A character entity is divided into three parts: The first part is an & symbol, the English name is ampersand; the second part is the entity name or # With the entity number; the third part is a semicolon.

For example, to display a smaller sign, you can write & lt; or & #60 ;.

The advantage of using an entity name is that it is easy to understand. When you look at it, you can probably guess what it means to be less, however, not all browsers support the latest Entity names. Entity numbers can be processed by various browsers.

Note: entity is case sensitive.

 

How to display Spaces

Generally, HTML automatically removes unnecessary spaces. No matter how many spaces you add, it is regarded as a space. For example, if you add 10 spaces between two words, HTML removes 9 spaces and retains only one space. To add spaces to a webpage, you can use & nbsp; to indicate spaces.

 

Character entities)

Display result Description Entity name Entity number
  Display a space & Nbsp; & #160;
< Less & Lt; & #60;
> Greater & Gt; & #62;
& & Symbol & Amp; & #38;
" Double quotation marks & Quot; & Amp; #34;
Character entities)
Display result Description Entity name Entity number
? Copyright & Copy; & #169;
? Registered Trademark & Reg; & #174;
× Multiplication number & Times; & #215;
Bytes Division Number & Divide; & #247;
Character entities)

For more character entities (character entities), see ISO Latin-1 character set.

 

Let's take a look at two examples.

Create a hyperlink

This example shows how to create a hyperlink in an HTML file.

Use an image as a hyperlink

This example shows how to use an image as a hyperlink, that is, click an image to connect to other files.

A And href attributes

HTML uses <A> to represent hyperlinks. The English name is anchor.

<A> you can point to any file source: an HTML webpage, an image, or a video file. The usage is as follows:

<A href = "url"> link display text </a>

Click <A> </a> to open a link file. The href attribute indicates the path of the link file.

For example, to link to the first page of the admin5.com/htmlsite, you can use this example:

<A href = "http://www.admin5.com/html"> webmaster college admin5.com/htmlhome </a>
Target attribute

You can use the target attribute to open a linked file in a new window.

<A href = "http://www.admin5.com/html" target = _ blank> webmaster college admin5.com/htmlhome </a>

Example

Title attribute

By using the title attribute, You can hover your mouse over a hyperlink to display text comments of the hyperlink.

<A href = "http://www.admin5.com/html" Title = "webmaster webmasters College web tutorials and code of the Chinese site"> webmaster webmasters College website </a>

If you want to annotate multiple lines for display, you can use & #10; as a line break.

<A href = "http://www.admin5.com/html" Title = "webmaster webmasters College & #10; web tutorials and code of the Chinese site"> webmaster webmasters College website </a>

Example

Name attribute

You can use the name attribute to jump to a specified part of a file.

To use the name attribute, set a pair. One is to set the name, and the other is to set an href pointing to this name:

<A href = "# C1"> see Chapter 1 </a>
<A name = "C1"> Chapter 1 </a>

Example

The name attribute is usually used to create a chapter directory (Table of Contents) for a large file ). Each chapter creates a link and stores it at the beginning of the file. The name attribute is set at the beginning of each chapter. When a user clicks the link of a chapter, the content of this chapter is displayed at the top.

If the browser cannot find the part specified by name, it will display the beginning of the article and no error will be reported.

Link to email address

On the website, you will often see the "Contact Us" link. Clicking this link will trigger your mail client, such as Outlook Express, and display a new mail window. You can use <A> to implement this function.

<A href = "mailto: info@sina.com"> contact Sina </a>

Example

 

 

Relative HTML path and absolute path)

HTML beginners often encounter such a problem: how to correctly reference a file. For example, how to reference another HTML webpage as a hyperlink in an HTML webpage )? How can I insert an image into a webpage ?...... (Related Tutorials: HTML hyperlinks and HTML images)

If you use an incorrect file path when referencing a file (such as adding a hyperlink or inserting an image), the reference will become invalid (you cannot browse the linked file, or the inserted image cannot be displayed ).

To avoid these errors and reference files correctly, we need to learn the HTML path.

HTML has two paths: relative path and absolute path.

File Reference of the same directory in the relative HTML path (relative path)

If the source file and the Referenced File are in the same directory, you can directly write the referenced file name.

We now create a source file info.html, which uses the index.html file as a hyperlink.

False info.html path: C:/inetpub/wwwroot/sites/blabla/info.html
The hypothetical index.html path is: C:/inetpub/wwwroot/sites/blabla/index.html.
The code for adding the index.html hyperlink to info.html should be written as follows:

<a href = "index.html">index.html</a>

 

How to represent the parent directory

.../Indicates the upper-level directory of the directory where the source file is located,.../indicates the upper-level directory of the directory where the source file is located, and so on.

False info.html path: C:/inetpub/wwwroot/sites/blabla/info.html
The hypothetical index.html path is: C:/inetpub/wwwroot/sites/index.html.
The code for adding the index.html hyperlink to info.html should be written as follows:

<a href = "../index.html">index.html</a>

 

False info.html path: C:/inetpub/wwwroot/sites/blabla/info.html
The hypothetical index.html path is: C:/inetpub/wwwroot/index.html.
The code for adding the index.html hyperlink to info.html should be written as follows:

<a href = "../../index.html">index.html</a>

 

False info.html path: C:/inetpub/wwwroot/sites/blabla/info.html
The hypothetical index.html path is: C:/inetpub/wwwroot/sites/wowstory/index.html.
The code for adding the index.html hyperlink to info.html should be written as follows:

<a href = "../wowstory/index.html">index.html</a>
How to represent a sub-directory

Reference the file in the lower-level directory and directly write the path of the lower-level directory file.

False info.html path: C:/inetpub/wwwroot/sites/blabla/info.html
The hypothetical index.html path is: C:/inetpub/wwwroot/sites/blabla/html/index.html.
The code for adding the index.html hyperlink to info.html should be written as follows:

<a href = "html/index.html">index.html</a>

 

False info.html path: C:/inetpub/wwwroot/sites/blabla/info.html
The hypothetical index.html path is: C:/inetpub/wwwroot/sites/blabla/html/tutorials/index.html.
The code for adding the index.html hyperlink to info.html should be written as follows:

<a href = "html/tutorials/index.html">index.html</a>
Absolute HTML path (absolute path)

Absolute path refers to the complete path of the file with a domain name.

Assume that you have registered a domain name license.

Assume that you have stored index.html in the wwwroot directory. The absolute path of this file is http://www.admin5.com/html.

Assume that you have created a directory named html_tutorials in the wwwroot directory, and then put index.html in the directory. The absolute path of this file is http://www.admin5.com/html/html_tutorials/index.html.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.