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