Enter HTML5 entry to proficient:<base> label

Source: Internet
Author: User
Keywords tags HTML5 Getting started to master

<base> Label

Definitions and usage

The <base> label sets the default address or default destination for all links on the page.

Typically, the browser extracts the corresponding element from the URL of the current document to fill in the blanks in the relative URL.

Using <base> labels can change that. The browser will then no longer use the URL of the current document and use the specified base URL to resolve all relative URLs. This includes URLs in the <a>, <img>, <link>, <form> tags.

The <base> label must be inside the head element.

Instance

Example 1

Suppose the absolute address of the image is:

<img src= "Http://www.w3school.com.cn/i/pic.gif"/>

Now we insert the <base> tag in the head section of the page to specify the base URL for all links in the page:

<head>
<base href= "http://www.w3school.com.cn/i/"/>
</head>

When inserting an image on a page in the previous example, we must specify a relative address, and the browser will look for the full URL used by the file:

<img src= "Pic.gif"/>

Example 2

Specify the default URL and default target for all links on the page:

<head>
<base href= "http://www.w3school.com.cn/css/" target= "_blank"/>
</head>
<body>
<a href= "Default.asp" >w3school ' s CSS tutorial</a>
</body>

Try it for yourself.

Differences between HTML 4.01 and HTML 5

None

Tips and comments

Tip: Place the <base> tab in the first element of the head element so that other elements in the head can be used

The information in the <base> element.

Note: In a document, you can use up to one <base> element.

Property

The

property value describes the URL that the href URL requires to be used as a base URL in the page. Target _blank _parent _self _top where to open the links on the page. This property is overwritten by the target attribute in each link.

Standard properties and Events

No.

Related Article

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.