Sunday, July 3, 2011

HTML STYLES

HTML Style

HTML is quite limited when it comes to the appearance of its elements. This is not so good if you're trying to give a website a unique look and feel, or you're trying to adhere to a corporate identity.

But, never fear - CSS is here!

CSS stands for Cascading Style Sheets, and its purpose is to enable web authors/designers to apply styles across their websites. With CSS, you can specify a number of style properties for a given HTML element. Each property has a name and a value, separated by a colon (:). Each property declaration is separated by a semi-colon (;).


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 separate style sheet files (CSS files)
* in the style element in the HTML head section
* in the style attribute in single HTML elements

HTML Style Example - Font, Color and Size

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

<*html>

<*body>
<*h1 style="font-family:verdana;">A heading<*/h1>
<*p style="font-family:arial;color:red;font-size:20px;">A paragraph.<*/p>
<*/body>

<*/html>


PLEASE Remove Firstly All Asterics *

Results:





A heading


A paragraph.






Example of Style Sheet Usage

HTML Code:


<*p style="color:olive;font-size:24px;"*>HTML Styles with CSS<*/p>


PLEASE Remove Firstly All Asterics *

Results:


HTML Styles with CSS



The above code is an example of inline styles. It is called inline because we declared the styles within the HTML tag itself. We could also use embedded styles or even external styles.

Embedded styles refers to declaring all styles in one place (usually the head of the document). Each element then knows to use the style that was previously declared.

External styles refers to creating a separate file that contains all style information. This file is then linked to from as many HTML pages as you like - even the whole site.

For more information on styles, see the CSS Tutorial.

To see what styles you can apply, check out the full list of CSS properties.

Deprecated Tags and Attributes

In HTML 4, several tags and attributes were deprecated. Deprecated means that they will not be supported in future versions of HTML.


Tags Description

<*center> Deprecated. Defines centered content
<*font> and <*basefont> Deprecated. Defines HTML fonts
<*s> and <*strike> Deprecated. Defines strikethrough text
<*u> Deprecated. Defines underlined text

Attributes Description

align Deprecated. Defines the alignment of text
bgcolor Deprecated. Defines the background color
color Deprecated. Defines the text color

THANK YOU