HTMLtag specifies the default address or default target for all links on the page

WBOY
Release: 2016-09-14 09:24:02
Original
1772 people have browsed it

Definition and Usage

The

tag specifies the default address or default target for all links on the page.

Normally, the browser will fill in the gaps in the relative URL by extracting the corresponding elements from the URL of the current document.

Use thetag to change this. The browser will then no longer use the URL of the current document, but will use the specified base URL to resolve all relative URLs. This includes URLs in,,,

tags.

tag must be located inside the head element.

Optional attributes

Property Value Description
target
  • _blank
  • _parent
  • _self
  • _top
  • framename
Where to open all the links on the page.

Case:

  <base href="http://www.w3school.com.cn/i/" /> <base target="_blank" /> 
"eg_smile.gif" />

请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片:

"http://www.w3school.com.cn/i/eg_smile.gif"



"http://www.w3school.com.cn">W3School

请注意,链接会在新窗口中打开,即使链接中没有 target="_blank" 属性。这是因为 base 元素的 target 属性已经被设置为 "_blank" 了。

Copy after login
   "Content-Type" content="text/html; charset=gb2312" /> "Content-Language" content="zh-cn" /> <base target="_blank" /> 

"http://www.w3school.com.cn" target="_blank">这个连接 将在新窗口中加载,因为 target 属性被设置为 "_blank"

"http://www.w3school.com.cn">这个连接 也将在新窗口中加载,即使没有 target 属性。

Copy after login

Base object

The Base object represents the base element of HTML.

Every timeappears in an HTML document, a Base object is created.

Base object properties

Property Description
href Set or return the base URL for all links in the page.
id Sets or returns the id of theelement.
target Set or return the default target frame for all links in the page.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!