Cascading Style Sheets


Cascading Style Sheets are the way to design web pages. Even though the layout can be done in HTML, CSS is better because you can specify that for all these attributes you want a single type of design. Lets take an example.

Say you want to make each header green in colour. In HTML, you will have to specify the color attribute every time you declare a header. In CSS, you just say, like this:


h1

{

color:green;

}

And then, every time you declare a header, its color will automatically be set to green.
This is just a small example. Now, imagine that you have to set different styles each for a table, an ordered list, an unordered list, for the footer and the sidebar, then such a task will result in you having to write a huge amount of code in HTML just to make it look better.

Instead, what you can do is, decide the styles of the attributes, and then, in the above format, write them in a notepad file or so, save the file and include it in the html file. This will make the work easier, and also, CSS is built for styling while HTML is built mainly for content.

Now, how to link CSS pages inside your HTML document?

There is a simple line for that


<link href="stylesheet.css">

This is assuming that you have named your CSS sheets stylesheet.css. It is that simple.

Here is a sample CSS sheet which I use for my website designs.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s