HTML <base> Tags Specify default address or default destination for all links on the page

Source: Internet
Author: User

Definition and usage

The <base> tab specifies 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 whitespace in the relative url.

Using <base> tags can change this. 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>, , <link>, <form> tags.

The <base> tag must be inside the head Element.

Optional properties
Properties value Description
Target
  • _blank
  • _parent
  • _self
  • _top
  • FrameName
Where to open all the links in the Page.

Case:

Basehref="http://www.w3school.com.cn/i/"/><Basetarget="_blank"/>"Eg_smile.gif"/><br/><p> Please note that we have specified a relative address for the Image. Since we have set a benchmark URL in the head section, the browser will look for a picture at the following address:</p><p>"Http://www.w3school.com.cn/i/eg_smile.gif"</p><br/><br/><p><a href="http://www.w3school.com.cn">W3School</a></p><p> Note that the link opens in a new window, even if there is no target= in the link"_blank"Property. This is becauseBaseThe target property of the element has been set to"_blank"The </p></body>
<! DOCTYPE Html>"Content-type"Content="text/html; charset=gb2312"/><meta http-equiv="Content-language"Content="ZH-CN"/><Basetarget="_blank"/>"http://www.w3school.com.cn"target="_blank"> This connection </a> will be loaded in a new window because the target property is set to"_blank". </p><p><a href="http://www.w3school.com.cn"> This connection </a>will also be loaded in a new window, even without the target Property. </p></body>Base Object

The base object represents the base element of the HTML.

The base object is created in the HTML document <base> every time it appears.

Base Object Properties
Properties Description
Href Sets or returns the base URL for all links in the Page.
Id Sets or returns the ID of the <base> element.
Target Sets or returns the default target frame for all links in the Page.

HTML <base> Tags Specify default address or default destination for all links on the page

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.