Home / code / css

CSS

CSS is short for Cascading Style Sheet
There are 3 different way's on how you can use this.

Inline Style Sheets

This used inside the body. But first you have to add a tag in the <head> so the browser knows what you are doing.
<meta http-equiv=”content-style-type” content=”text/css”>
Now you can add a lot of tags, like:
<p style=”font-size: 12 pt; color: fuchsia”>
Now you can see this does what the <font> does. So you don't win much.

Embedded Style Sheets

This way you write everything in the <head>. For example you can change everything in the <p> with only 1 line.
Like this :

<style type="text/css">
   body {background:#0000FF; color:#FFFF00; margin-left:0.5in; margin-right:0.5in}
   h1 {font-size:18pt; color:#FF0000; background:#FFFFFF}
   p {font-size:12pt; text-indent:0.5in}
</style>
But you still need to put it in every page.

External Style Sheets

This one is the most used because you can change an entire site with just 1 file.
Here you define everything in a separated file, called *.CSS.
You write it the same way as the embedded style sheets, except the tags <>

body {background:#0000FF; color:#FFFF00; margin-left:0.5in; margin-right:0.5in}
h1 {font-size:18pt; color:#FF0000; background:#FFFFFF}
p {font-size:12pt; text-indent:0.5in}

You have to call it up in your html file. Do this with the following line:

<link href="mystyle.css" rel="stylesheet" type="text/css">

As you can see this way you can do the makeup of several pages with only 1 CSS-file.
So if you want to change the layout of your site you only have to update 1 file instead of 100 or so.

A list of everything you can use in style sheets.
Right here.

 

TOP

Latest script:

 

Books: