Tuesday 23 October 2012

Web Design week 5

Now for the good stuff CSS (Cascading Style Sheets)

 CSS define how to display/style a website.


External style sheets save alot of work

    h1             { color      :    blue  ;            font-size   :   12px; }
selector           property      value               property        value

can also be written as

h1 {

color:blue;
font-size:12px;

}


A id or class is a way of specifying your own selectors

for example <div class ="peter">

can be styled

.peter {

font-height:1em;
font-family:sans-serif;

}



Linking style sheets

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

that links the file to a styles.css file that is within a css folder.



Order is important!!!!

CSS is read from top to bottom so a style at the top will be overridden by a style at the bottom.

For example

p {
color: pink;
font-size:20px;
}

then later in the stylesheet you have

p {
color: green;
font-size:12px;
}

the second CSS command will be displayed.

To overcome this we use the id's or classes


No comments:

Post a Comment