Tuesday, April 10, 2012

HTML Beginner tutorial 9 HTML Styles

Styling HTML with CSS
CSS is used to style HTML elements.
CSS was introduced together with HTML 4, to provide a better way to style HTML elements.
CSS can be added to HTML in the following ways:
  • in Cascading Style Sheet files (CSS files)
  • in the <style> element in the HTML head section
  • in the style attribute in single HTML elements

Using the HTML Style Attribute

It is time consuming and not very practical to style HTML elements using the style attribute.
The preferred way to add CSS to HTML, is to put CSS syntax in separate CSS files.
However, in this HTML tutorial we will introduce you to CSS using the style attribute. This is done to simplify the examples.

HTML Style  - Background Color

The background-color property defines the background color for an element:
For example

html style background color
html style background color.


The background-color property makes the "old" bgcolor attribute obsolete.


HTML Style - Font, Color and Size

The font-family, color, and font-size properties defines the font, color, and size of the text in an element:
For example

html style font color size
html style font color size.


The font-family, color, and font-size properties make the old <font> tag obsolete.


HTML Style - Text Alignment

The text-align property specifies the horizontal alignment of text in an element:
For example

html style text alignment
html style text alignment.


The text-align property makes the old <center> tag obsolete.


HTML Beginner tutorial 10 : HTML Links  >>

<<  HTML Beginner tutorial 8 : HTML Fonts

No comments:

Post a Comment