HTML base tag

 The HTML base tag can be used to control the link attributes in the web page. When the web designer uses the base tag, the default opening target of all links in the web page will be opened according to the requirements of the base tag. For example, use target=" in <base> Attributes like _blank", other links in the webpage, even if target="_blank" is not used, can still be used to open in new windows.


HTML base tag syntax
<base target="value">、<base href="value">
The HTML <base> tag has two attributes that can be used, target and href, which can be written in the same <base> tag, or can be divided into two <base> tags.

HTML base attribute table
AttributesProperty value description
href
The default web page URL, if the link destination in the web page is not set, it will be the main one.
target
target="_blank". Open the link in a new window.

target="_parent". Open the link in the parent window.

target="_self". Open the link directly in the frame. If there is no frame, it is equivalent to open the link directly in the same window.

target="_top". Open the link in top mode.

HTML base tag example
<head>
<base href="https://jasonchen050319.blogspot.com/" target="_self">
</head>
<a href="#">Jason SEO</a>
Present results

Jason SEO

As shown in the example, the HTML <base> tag must be written in the <head> area, beyond this area will be invalid tags, we will write the href and target two attributes in the same <base> tag, the advantage is that it can save Code space. 
When the 
hyperlink in the page only has a URL like #, which is a fake link, when the netizen chooses the link, the browser will take the netizen to the default webpage according to the href attribute value set in the <base> in the head area , And the opening method is opened with the attribute value set by target.

Post a Comment

0 Comments