HTML 5 <base> tag
Definition and Usage
The base element specifies a base URL for all the links in a page.
Differences Between HTML 4.01 and HTML 5
None
Tips and Notes
Note: The <base> tag must go inside the head element.
Note: Maximum one <base> element in a
document.
Example
Assume that the absolute address for an image is:
| <img src="http://www.w3schools.com/images/smile.gif" />
|
Now we insert the <base> tag, which specifies a base URL for all of the
links in a page, in the head section of a page:
<head>
<base href="http://www.w3schools.com/images/" />
</head> |
When inserting images on the page in the example above, we just have to specify the
relative address, and the browser will look for that file using the full URL,
"http://www.w3schools.com/images/smile.gif":
Attributes
- 4: indicates if the attribute is defined in HTML 4.01
- 5: indicates if the attribute is defined in HTML 5
| Attribute |
Value |
Description |
5 |
4 |
| href |
URL |
Specifies the URL to use as the base URL for links in the page |
4 |
5 |
| target |
_blank
_parent
_self
_top |
Where to open all the links on the page. This attribute can be overridden by
using the target attribute in each link.
- _blank - all the links will open in new windows
- _self - all the links will open in the same frame they where clicked
- _parent - all the links will open in the parent frameset
- _top - all the links will open in the full body of the window
|
4 |
5 |
Standard Attributes and Events
NONE
Try-It-Yourself Demos
One target for all links
How to use the <base> tag to let all the links on a page have the same target.
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a free 30-day trial today!
Click to see a demo!
Learn what’s new in v2008
 |
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
|
|