w3resource

HTML base tag and element

1. If a base element is used in an HTML document, it specifies a URL, which is applied to all relative elements of that document.

2. base element starts with <base> tag and it's end tag is forbidden.

Syntax

<base href="URL" />

Whether both start and end tags are required

The start tag is required but end tag is forbidden.

Can contain

HTML base element is an empty element, i.e. it can not contain any other text or element.

Can reside within

HTML base element can reside within head element.

Attributes

href.

Target frame information

target.

Example of using HTML base element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML link tag example > HTML tutorial | w3resource</title>
<base href="https://www.w3resource.com/">
</head>
<body>
<ul>
<li><a href="php/php-home.php">PHP Tutorial</a></li>
<li><a href="javascript/javascript.php">JavaScript Tutorial</a></li>
<li><a href="mysql/mysql-tutorials.php">MySQL Tutorial</a></li>
</ul>
</body>
</html>

result

html base element

View this example in a separate browser window

HTML base tag example.

Previous: HTML link tag and element
Next: HTML img tag and element

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/html/base/HTML-base-tag-and-element.php