Visit our FaceBook Page

CSS (Cascading Style Sheets)

CSS stands for cascading style sheets and is used for applying visual layout and style to your HTML documents. It is a fairly straight forward language and can be used across several HTML documents.

To use CSS you must first create a CSS file, lets start by creating one called "screen.css".  

%2F%2ACSS+Document%2A%2F%0D%0ABODY%0D%0A%7B%0D%0A++++background-color%3A+%23cccccc%3B%0D%0A%7D%0D%0AH1%0D%0A%7B%0D%0A++++++++color%3A+%23ffffff%3B%0D%0A%7D

What we did here is we created two "rules" one for the BODY and one for the H1 tag. As you can see from the rules outlined, we have set the BODY to have a background color of "#cccccc" or neutral grey and made the color of the H1 content "#ffffff" or white.

To use this in your document, you must like to it in your HTML file.

%3Chtml%3E%0D%0A++++%3Chead%3E%0D%0A++++++++%3Clink+href%3D%22css%2Fscreen.css%22+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+%2F%3E%0D%0A++++%3C%2Fhead%3E%0D%0A++++%3Cbody%3E%0D%0A++++++++%3Ch1%3EHello+World%21%3C%2Fh1%3E%0D%0A++++%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E

You may reuse a CSS file amongst many HTML files, this offers you the ability to control the look and feel across your entire website with one file.  If you wonder why you should do this rather than control your styles in-line, consider how much it would pain you if your client asked you to change the color of all your H1 tags through 100 or 1000 pages.

CSS get much deeper than this but this is the essence of it. To learn more check out the articles under CSS in the menu or visit W3Schools as they cover this extensively.

Reader Comments


loading...