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
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

View this example in a separate browser window
Previous: HTML link tag and element
Next: HTML img tag and element
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook