Home > Web Front-end > HTML Tutorial > What is the role of the html base tag? Analysis of the role of the base tag (with examples)

What is the role of the html base tag? Analysis of the role of the base tag (with examples)

寻∝梦
Release: 2018-09-05 13:59:12
Original
6975 people have browsed it

This article mainly introduces the usage of HTML base tag, as well as the analysis of the role of HTML base tag. Next, let us read this article together

First we analyze the role of the html base tag:

The base tag is the base URL tag in the HTML language. It is a single tag located in the head tag of the web page header file. Within, a page can only use at most one base element, which is used to provide a specified default target, which can also be regarded as a mark that expresses the path and connection URL.

Common URL path forms include relative paths and absolute paths respectively. If the base tag specifies a target, the browser will use this target to parse all relative paths in the current document, including tags (a, img , link, form), that is to say, the browser will add the target given by base before the path when parsing, and the relative paths in the page will also be converted into absolute paths. When using the base tag, you should bring the href attribute and target attribute.

Let’s talk about the base href attribute:

For example, if a URL address is specified by base, then you don’t need to fill in the complete address for the file or image you want to call. , just write the file name or picture name. Use the picture below to briefly understand the usage of the base tag. Link to the HTML video tutorial on the PHP Chinese website. The full address is http://www.php.cn/course/list/11.html

<head>
<base href="http://www.php.cn/course/list/11.html/ target="_blank" />
</head>
<body>
<a href="html视频教程">PHP中文网</a>
</body>
Copy after login
## The #base tag specifies the PHP Chinese website html video tutorial as the base URL. Then all hyperlinks in the current document will follow this rule. We set the relative access target in the link, and the browser will automatically parse a complete Access the link address. If the target of the link a is empty, the browser will also access it based on the url given by base. It is worth noting that the base tag needs to be placed in front of the statement containing the url address.

Let’s talk about the base target attribute:

The target attribute is the way to open the web page window. If you set this attribute in the base tag, then all the links in the page will be Following this method to open a web page, you have the following options:

  • _blank: Open the linked page in a new window.

  • _parent: Open the link in the previous window.

  • _self: Open the link in the current window. This is the default value and can be omitted.

  • _top: Open the link in the entire browser window, ignoring any frames.

html Analysis of the role of base tag:

This is the basic HTML language. Use to set the target window of all links on this web page. In other words, as long as the sentence is added to the web page, then all hyperlinks do not need to be set separately. It is best to write this sentence between and . For example, means that the target addresses of all hyperlinks in the web page are opened in a new window.

The meaning of the HTML base tag in JSP: ## The #base tag is a base link tag and is a single tag. Used to change the parameter default value for all link tags in the document. It can only be applied between the tags and .

All relative paths on your web page will be preceded by the address pointed to by the base link when linking.

jsp page can be defined: <% String basePath = request.getScheme() "://" request.getServerName() ":" request.getServerPort() path "/";%>

Add after the head tag.

The above is an introduction to the role of the HTML base tag (if you want to learn more HTML knowledge, come to the PHP Chinese website

HTML video tutorial

). If you have any questions, you can leave a message below. . Here is also an introduction to the use of the html base tag: How to use the html base tag? Summary of usage of html base tag[Editor’s recommendation]

How to set up the html search box? Examples of how to use the input tag in the html search box


What are the attributes of the html input tag? Summary of usage of input tag (with examples)

The above is the detailed content of What is the role of the html base tag? Analysis of the role of the base tag (with examples). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template