|
|
|
Css or Cascading Styles Sheets are used to define a certain style for a whole web site. This files can be either internal or external. The great thing about using a css files, is when you want to change the whole look of you web site from just one file. Imagine you have a web site that consisted of 20 web pages, and you wanted to change the background from white to black. This means normally you would have to change the background color on all 20 web pages. Well with a css file, you could put a external link to your css file in between the <head> and the </head> on each of your web pages. Then inside the css file, type one line of code and automatically change the color of all your web pages instantly. Change Background color on all web pages.
Example: <head> <link rel="stylesheet" type="text/css" href="http://address.com" /></head> ----This is the css file below here, simply save file inside notepad called control.css--- body <----This refers to the tag { Always remember to us semi colons after each command.To see the CSS file for this web site. For more information on how to create your own css file for your web site.
Another Example - Make all the <h1> tags blue and bold.h1 { color: blue; font-weight: bolder; } To Control only certain tags on all the pagesIf you only wanted to control certain tags on certain pages, then you are going to have to name each tag. You can name each tag with the id attribute. Pretty much all tags can use the id attribute. So if you only wanted to change to border color to red on two different tables on your whole web site, then you are going to have to name each table you want to change. After naming each table, you then have to refer to it inside your css file. Below you will see the exact exercise. How to put the id Attribute inside your tags. <---This is inside your web pages<html><head><link rel="stylesheet" type="text/css" href="http://address.com" /> </head><body> <table id="whatevername">Table Contents</table</body></html> How to refer to the id attribute inside a css filetable#whatevername { border-color: red; } To see what my web site style sheet looks like click here. |