What is the base tag and what does it do?

What is the base tag and what does it do?

The <base> tag specifies the default address or default target for all links on a page.
Normally, browsers fill in the blanks in relative URLs by extracting the corresponding elements from the URL of the current document.
Use the <base> tag to change this. The browser will then resolve all relative URLs using the specified base URL instead of the current document's URL. This includes URLs in <a>, <img>, <link>, and <form> tags.

test:

1: The link path placed before the base tag can use a relative path and is relative to the current path.
However, the link placed after it using a relative path will be relative to the path specified by base.
2: After using the base tag, the relative path of the link in the body will be relative to the path specified by base.
3: After using the base default target, the subsequent opening method will be opened in the method specified by base, unless the opening method is explicitly defined later.
Summary: base actually defines a default address and default target. All subsequent link elements will work.

<<:  Attributes in vue v-for loop object

>>:  Nginx reverse proxy to go-fastdfs case explanation

Recommend

Detailed explanation of the getBoundingClientRect() method in js

1. getBoundingClientRect() Analysis The getBoundi...

HTML head structure

The following introduces the commonly used head s...

Implementation of Docker deployment of Nuxt.js project

Docker official documentation: https://docs.docke...

Sample code for JS album image shaking and enlarging display effect

The previous article introduced how to achieve a ...

Summarize the problems encountered in using Vue Element UI

Table of contents 1. DateTimePicker date selectio...

Causes and solutions for MySQL data loss

Table of contents Preface Problem Description Cau...

You Probably Don’t Need to Use Switch Statements in JavaScript

Table of contents No switch, no complex code bloc...

Detailed explanation of the use of mysql explain (analysis index)

EXPLAIN shows how MySQL uses indexes to process s...

An article to give you a deep understanding of Mysql triggers

Table of contents 1. When inserting or modifying ...

A detailed introduction to Linux system configuration (service control)

Table of contents Preface 1. System Service Contr...

Use three.js to achieve cool acid style 3D page effects

This article mainly introduces how to use the Rea...

Parse CSS to extract image theme color function (tips)

background It all started when a classmate in the...

JavaScript offsetParent case study

1. Definition of offsetParent: offsetParent is th...

WeChat applet to achieve the revolving lantern effect example

Preface In daily development, we often encounter ...