HTML tags provide the foundation for web page design. To provide more flexibility with HTML design, attributes have been defined for HTML tags to alter the behavior of any particular HTML tag. There are many instances while designing a web page when you will want to change the default behavior of the tag. For instance, you might want to change the background color of the whole page or some section of the page. You might want to change the alignment of a section of text or apply a unique style to a tag's representation. There are many instances when you would want to identify an HTML tag by giving it a name to identify it so that it can be referred to elsewhere. Some tags, such as the one used to present an image () do not do much of anything without having at least one attribute defined. In the case of the image tag, you would need to have an attribute that tells the browser where the find the image to be displayed.
Some Examples of HTML Attributes
Using bgcolor and background with the body tag
A very visible example of the effect of an attribute used in an HTML tag is changing the background color or image for the entire body of a web page. Browsers understand that the contents of the tag will be displayed on the main part of the web page. By default, the background used by browsers when they encounter the tag is white. If you want a background color other than white, you would use the bgcolor attribute. The following tag changes the background color of a web page from the default white to gray:
If you want to have an image comprise the background for a web page, you could use the following code:
This example assumes that you have a folder on your web server called images, and that inside that folder there is an image named background.gif. In the case of a background image, if the image is not large enough to fill the entire background of your web page, the browser will repeat the image vertically and horizontally to fill the background.
Linking using the anchor tag
The world wide web's fundamental usefulness hinges on its ability to link documents, providing web users with a quick connection from one page to another related page. Linking documents in HTML is done using the anchor () tag. The anchor tag by itself does not tell the browser where to link. Instead, you have to include the href attribute as in the following example:
Visit our sponsor
This piece of HTML code tells the browser that the text "Visit our sponsor" is the anchor text for a link. When the user clicks on the anchor text, he is taken to the url oursponsorswebsite.com.
Displaying a picture using the image tag
HTML pages would be pretty boring without the use of images. The need to tell the browser where to find an image is a good example of how to use HTML attributes. Images are included using. Similar to the anchor tag example above, using the tag alone would not suffice. The image tag attribute "src" is required to tell the browser where to find the image to be displayed, as in the following example:
This block of code tells the browser to place an image in the document. The browser is instructed to get the logo.gif image from the images folder located in the top level folder for the document. You also notice a width attribute defined in the tag. This constrains the image to be 150 pixels wide. Conveniently, the height of the image is constrained proportionally when the width attribute is defined.
HTML Attributes Reference
Do not feel like you have to memorize all the HTML tags and their corresponding attributes. Instead, it is convenient to access a reference when trying to determine which attributes can be used with particular HTML tags. Official definition for The HTML tags and attributes can be found at www.w3.org You can Also the find : other resources for understanding the SAME information by vBulletin® using a Suche engine to Suche for "html tags" or "html attributes"
Beyond HTML Attributes
In the mid-1990's, a methodology called Cascading Style Sheets (CSS) was developed for use in web pages to make them more streamlined. CSS is a standard for defining the layout and formatting for a web page. Many of the attributes that were commonly used with HTML tags before CSS came around are now handles by CSS definitions. For designers unfamiliar with CSS or who, for whatever reason, do not choose to use CSS, HTML attributes that overlap with CSS definitions can still be used to change the behavior of HTML tags. However, to be considered vogue in the world of web design, it is recommended that you learn and use CSS.