Wednesday, 25 March 2009

Methods of using CSS in a HTML file

Cascading Style Sheets have revolutionised the HTM editing of pages by offering an effective solution to lengthy coding. CSS is used to set different styles and fonts and then reuse them inside the webpage HTML. The reusability feature has really made CSS so popular. Let us take a look at the following methods to use CSS insie HTML.
There are essentially three methods to use CSS

1. Inline Linking
2. Internal Linking
3. External Linking

1. Inline Linking
Use the CSS code inside the HTML tags . Here is an example to do so



2. Internal Linking

Internal linking means defining CSS styles inside the web page and then using those styles inside the coe. Here is an example of internal CSS linking

3. External Linking

Save your CSS styles in an external style sheet file. Make the extension CSS

Link the file in an HTML page and then use the code. This method is very simple and you can make a global CSS file and use the styles site-wide. This allows you to change your styles throughout with just one click.

First make a text file with a name.css

Say style. css and append the following code to it

Once you have done this, you can embed this style sheet in any page and use it. The code line here shows the linking procedure


Now you can add CSS to your website and use its styles inside your webpages


See Also

What is a CSS?

No comments:

Post a Comment