Intro to CSS
Author: Bill Trikojus
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
|
<head> <title>Page 1</title> </head> <body> <p>Some content</p> And some more content </body> </html>
|
|
![]() |
|
|
font-family: sans-serif; font-size: 1em; color: #333333; }
< title>Page 1</title> <link rel="stylesheet" type="text/css" href="my.css" /> < /head> Save your file again and view it in a browser. As you can see, the font face, colour and size of the text inside the <p> tag are now being controlled by your CSS. Have a play around with the 3 lines in the CSS and change the values to see the changes reflected in your HTML page. Now, this may not seem that powerful but imagine you have 500 html pages all getting their styles from the same CSS. If the company changed its logo colours and wanted the website content to reflect these changes it would simply requires changing a few lines in the CSS and the entire site would update. |
|
![]() |
|
|
font-family: Verdana, Geneva, Arial, helvetica, sans-serif; margin:0px; } p{ font-family: sans-serif; font-size: 1em; color: #333333; } a:link {color: #003366} a:visited {color: #003366} a:hover {color: #FFCC00} a:active {color: #003366} h1{ font-size: 1em; font-style:bold; color: #FF0000; text-transform: uppercase; }
<head> <title>Page 1</title> <link rel="stylesheet" type="text/css" href="my.css" /> </head> <body> <h1>this is a heading</h1> <p>Some content</p> <p>here's a <a href='http://www.swin.edu.au/design'>link </a></p> </body> </html> Save both files and view the html file in the browser again. As you can see, headings, links, and the body tag can also be controlled with CSS. So can images, tables, lists...you name it.
} |
|
![]() |
|
|
font-family: sans-serif; font-size: 1em; color: #333333; } p.alert{ color: #FF0000; } and my html would like <p class='alert'>look out! this is an alert</p>
in the p{part. color: #FF0000; } Add the following to your CSS .alert2{color: #0000FF; }
<h1 class='alert2'>So am I!</h1>
|
|
Share
Like this? Click a link below to share it...Subscribe and Download

Post a comment
Garbage posts and SPAM will be deleted.





