HTML HTML intro.
  1. HTML intro
  2. Web pages and you
HTML basics
  1. HTML getting started
  2. HTML basics
  3. HTML document
HTML text
  1. HTML text formatting 1
  2. HTML text formatting 2
  3. HTML text formatting 3
  4. HTML fonts
  5. HTML entities
HTML links
  1. HTML links
  2. HTML email links
HTML images
  1. HTML images
  2. HTML image maps
HTML forms
  1. HTML forms
  2. HTML form labels
  3. HTML fieldset/legend
HTML tables
  1. HTML tables
  2. HTML tables concepts
HTML frames
  1. HTML frames
HTML backgrounds/color
  1. HTML backgrounds
  2. HTML colors
  3. HTML color shades
  4. HTML color usage
HTML style/layout
  1. HTML stylesheets
  2. HTML div/span
HTML media
  1. HTML audio
  2. HTML video
  3. HTML objects
  4. HTML download media
HTML declaratives
  1. HTML head section
  2. HTML meta tags
  3. HTML scripts
  4. HTML declarations
  5. HTML document types
Practical HTML
  1. HTML tag rules
  2. HTML things to avoid
  3. URL formatting
  4. URL encoding/decoding
  5. HTML use/access
  6. HTML publish work
HTML extras
  1. HTML marquees
HTML wrap-up
  1. HTML history
  2. HTML summary

HTML universal declarations

There can sometimes be so much text and/or so many links on a webpage that it can get tedious assigning the same properties to them. If for example, you want all your text to be the same color, or all your links are internal (within your own domain).

This tutorial focuses on:

Universal declarations?

'Universal declarations' refers to the ability given by some tags in HTML to assign a certain value to them and have it affect the rest of the webpage in some way. There are not many such tags in HTML, but the ones that do exist do make things easier.

It is a convenient and practical thing to assign a value in one place and have it referenced when needed instead of reassigning that value many times over.

The <base> tag

The <base> tag acts as a reference point for all the links on a page. This reference point is specified with the <base> tag's href attribute.

NOTE: The <base> tag must be placed in the head section of an HTML document. Also, the <base> tag has no end tag.

Lets say you run the website, and you have a page on this website whose absolute URL is On this page, you have seven images displayed and their absolute location is When you try to display these images on your page, you can do so by specifying their location as in <img src="/images/img1.jpg" />, <img src="/images/img2.jpg" />, and so on, OR you can use the <base> tag to specify a reference point for all the images to simplify displaying them on your page.

The <base> tag to be used in this situation would look like this:

<base href="" />

Now whenever you need to display an image on your page, you can do so by specifying the name of the image by its name alone, as in <img src="img1.jpg" />, <img src="img2.jpg" />, and so on, and the browser will automatically look for it in

Another attribute of the <base> tag is target. The target attribute specifies where to open the links on a webpage. The target attribute should be used in the <base> tag when you are using it for links.

Possible values for the target attribute
<html> <head> <title>Base target attribute</title> <base href="" target="_blank" /> </head> <body> <a href="page1.php">Link will open in a new page</a> <br /> <a href="page2.php">This one too</a> <br /> <a href="page3.php">And this one</a> <br /> <a href="page4.php">And this one too</a> </body> </html>

In the above example, the target attribute specifies that all the links on the page will open in a new window.

Is the <base> tag really necessary?

There are those who would say that the <base> tag is necessary, and there are those who would say it is not. The <base> tag is efficient in that it makes links work from anywhere. Suppose that someone downloads a page onto their hard drive -- without the <base> tag, or without specifying absolute URL's, the link(s) on the page will not work. Essentialy, the <base> tag is used to insure that a link is going to work. While it is not absolutely necessary, the <base> tag makes it possible for links to work from anywhere, and for this reason serves an important purpose in HTML.

The <basefont> tag

The <basefont> tag is used to set the font style for all the text on a webpage.

Using the <basefont> tag you can set the size, color, and font of all the text on a webpage.

The <basefont> tag should be placed right after the <body> tag.

<basefont> tag attributes:

NOTE: Notice how the <basefont> tag has the same attributes as the <font> tag.

<html> <head> <title>Basefont</title> </head> <body> <basefont size="3" face="Courier, Helvetica, Tahoma" color="#008000" /> This text will be in a size of 3, have a Courier font, and will be green </body> </html>
This text will be in a size 3, have a Courier font, and will be green

NOTE: If you specify a list of fonts with the face attribute like in the above example, the visitor's web browser will use the first font in the list that is available on the visitor's computer. Meaning, if someone is viewing a webpage and their computer does not support the first font you specify, the browser will try the second font and so on until it gets to a font that is supported. This applies to the <basefont> tag as well as the <font> tag.

The <basefont> tag:


HTML allows for universal declarations, but they are few and one of them (the <basefont> tag) is deprecated. For a much bigger possibility of universal declarations for webpages, CSS should be used instead.

With CSS, you can set many things such as the color of non-visited links, visited links, font of text, padding and margin of elements, and much more.

Visit our CSS tutorials to learn CSS.

© Copyright 2013-2014
Terms of use | Privacy policy | Copyright information