Base tag usage in html
The <base> tag specifies the URL or destination for all relative URLs in the document. A document can contain a <base> tag and must be defined within the <head> tag.
The purpose of use on our web page is written for the purpose of specifying the basic url link address of our site. While creating .htaccess rules in advanced Web design within our site, you will definitely come across it in pagination logic or search engine optimizations (SEO). There is no harm in using this tag, on the contrary, it will be a plus for your website.
<head>
<base href="https://www.codingsource.net/">
</head>
Basic Usage is as above.
How to Use Base Tag?
Html Base Tag should be used in head tags as follows. It should not be used outside of the head tag.
<head>
<base href="https://www.codingsource.net/" target="_blank">
</head>
This will open all other forms and links in the target you specified.
What Do the Parameters in the Base Tag Mean?
Below, I will explain to you what the Html base parameters mean, and besides, I will give you side information about how to use the base tag.
- href : It means the base address of your website.
- usage: url must be written.
- target : It determines the opened forms and the targets to which the links etc objects will go.
- _blank : Opening on another page.
- _parent : Opening on the side page.
- _self : Opening on the same page.
- _top : Opening at the top of the web page.
How to Use Base Tag
The base tag is very simple to use. It is placed inside the <head> tag, which is mostly used for search engine optimizations and has a few rules. Below I will explain with you the rules of using the HTML Base Tag.
The <base> tag must be written inside the <head> … </head> tag.
The closure of this tag is in itself. You do not need to do another closure.
Do not write any external url other than the url – link of your website.
On your website, css, js etc. are added to the beginning of the called files and your files are called in this way.