8. March 2010 14:07
A look into CSS
As anyone who has coded any html pages can tell you, formatting the layout and appearance of the text and images is a time consuming task. This becomes especially apparent if you have to write formatting code for each element and each individual web page. Often times you will be writing the same formatting code for each page. This can very quickly become a tedious task. To eliminate this headache, the World Wide Web Consortium created Cascading Style Sheets (CSS).
With CSS one can setup the colors, fonts, alignment, and so on for many html attributes. As opposed to nesting a countless number of styling tags, you can simply insert all of the formatting tags into one section of code or a separate file. When you use that particular HTML element, the browser will know to apply the defined formatting to the element. span>
The most common example we see used is that of the paragraph tag. Much like writing JavaScript, CSS code is written in between its own tags. Normally I'd used the P for the paragraph tag, but doing so would change the color of the whole blog. So for this purpose I am assigning a color attribute to an id selector.
For example:
<html>
<head>
<style type= “text/css”>
#p1
{
color:green;
}
</style>
</head>
<body>
<p id=p1> The line is green. </p>
</body>
</html>
The line is green. I used an id for the paragraph to keep the whole page from turning green.
02a9dccb-9e4d-49b5-86b6-90d7d768c3ef|0|.0