style
attribute introduces CSS to HTML.
style
attribute is to provide a common way to style all HTML elements.
Styles was introduced with HTML 4, as the new and preferred way to style HTML elements.
With HTML styles, styles can be added to HTML elements directly by using the style
attribute, or indirectly in separate style sheets.
style="background-color:yellow" style="font-family:Times" style="text-align:center"Style attributes are used in HTML tags such as the following examples.
<body style="background-color:yellow"> <p style="font-family:courier; color:red; font-size:20px"> <h1 style="text-align:center">Deprecated Tags and Attributes
Tags | Description | Attribute | Description | |
---|---|---|---|---|
<center> |
Defines centered content. | align |
Defines the alignment of text. | |
<font> or <basefont> |
Defines HTML fonts. | bgcolor |
Defines the background color. | |
<s> or <strike> |
Defines strikeout text. | color |
Defines the text color. | |
<u> |
Defines underlined text. |
All our dreams can come true, if we have the courage to pursue them. — Walt Disney |