Login | Contact Us | Site Map | Resources

Formatting HTML

Home > HTML Tutorial > HTML Attributes & Styles

HTML Attributes & Styles

HTML attributes are characteristics of an element that provide additional information or formatting. Some attributes are unique to the HTML elements that they are used with, and other attributes can be used on nearly any HTML element. Attributes are placed in opening HTML tags in the following manner:

<p style="align: center;"> </p>

The style attribute is (or should be) the most commonly used attribute, also known as inline CSS. Although there are other attributes that can be used, some will not be supported by future versions of HTML, instead their functions will be a part of the CSS styling.

Below is a list of the attributes that are currently available. The attributes in red are those losing support by HTML.

The Attribute The Options What It Does
align right, left or center Elements Align At Left, Right or Center (Horizontal)
valign top, middle or bottom Elements Align At Top, Bottom or Middle (Vertical)
bgcolor numeric, hexadecimal Places A Background Color Behind An Element
background URL Places A Background Image Behind An Element
color numeric, hexadecimal Defines the Text Color Of An Element
id Anything You Want Cascading Style Sheet Id Of An Element
class Anything You Want Cascading Style Sheet Class Of An Element
width A Number Specifies Width Of Tables, Table Cells & Images
height A Number Specifies Height Of Tables, Table Cells & Images
title User Defined Element Titles

If you don't completely understand attributes yet, don't panic. They will become more clear as you test your newly-acquired skills.