|
Tags can also have attributes, which are extra bits of information. Attributes appear inside the opening tag and their value is always inside quotation marks. They look something like <tag attribute="value">Margarine</tag>. We will come across tags with attributes later.
HTML Name Attribute
Name is different attribute from id and class. By allotting a name to an element, that name becomes a scripting variable for scripting languages such as Javascript, ASP and PHP. The name attribute is seen most often with forms and other user-input elements.
<input type="text" name="TextField" />
|
Output:
Head Title Attribute
| <html>
<head><title>Title Here!</title></head>
</html>
|
HTML Align Attribute
| <h1 align="left">Left Align Attribute</h1> |
Default Attribute
Many tags are assigned default attributes. This means that unless a tag attribute is specified by you the creator, it will have some distinct attributes. For example, a paragraph tag will always align its text to the left unless it has an align attribute in it specifying otherwise. Also elements placed within a table are vertically centered and to the left unless otherwise specified. As you code and learn about each of the different HTML elements, you will become aware of many of these defaults.
Generic Attribute
| Attribute |
Options |
Functions |
| align |
right, left, center |
Horizontally aligns tags |
| valign |
top, middle, bottom |
Vertically aligns tags within an HTML element. |
| bgcolor |
numeric, hexidecimal, RGB values |
Places a background color behind an element |
| background |
URL |
Places an background image behind an element |
| id |
User Defined |
Names an element for use with Cascading Style Sheets. |
| class |
User Defined |
Classifies an element for use with Cascading Style Sheets. |
| width |
Numeric Value |
Specifies the width of tables, images, or table cells. |
| height |
Numeric Value |
Specifies the height of tables, images, or table cells. |
| title |
User Defined |
"Pop-up" title for your elements.
|
|