base tag (XHTML 1.1)
document base URIThe base tag allows you to define a root path for your pages, which will be used when resolving relative paths to images, stylesheets, links etc. For instance, you may reference an image like this:
<img src="images/icons/happy.gif" />
With no base path defined, the browser will request the image from a directory called images, in the same folder as the document being requested. But if that document is already in another subfolder, the path will not be valid. You can define the root path with the base tag and the href attribute, which is required, like this:
<base href="http://www.yourdomain.com/website/" />
Now all your paths will be relative to this path.
Remember that the base path has to be defined within the head tag section of your website, preferably as the first child tag, to make sure that it has an impact on CSS references etc.
Attributes
| Attribute | Deprecated | Required | Description |
|---|---|---|---|
| class | space-separated list of classes | ||
| dir | direction for weak/neutral text | ||
| href | URI that acts as base URI | ||
| id | document-wide unique id | ||
| lang | language code | ||
| style | associated style info | ||
| target | render in this frame | ||
| title | advisory title |
Events
| Event | Description |
|---|---|
| onclick | a pointer button was clicked |
| ondblclick | a pointer button was double clicked |
| onkeydown | a key was pressed down |
| onkeypress | a key was pressed and released |
| onkeyup | a key was released |
| onmousedown | a pointer button was pressed down |
| onmousemove | a pointer was moved within |
| onmouseout | a pointer was moved away |
| onmouseover | a pointer was moved onto |
| onmouseup | a pointer button was released |