As we already saw in a previous blog (Web Design with CSS Part 1), Cascading Style Sheets (CSS) allow for much richer document appearances than HTML ever allowed.
CSS let you set colors on texts and in the background of any element . All the style information for a page can be centralized in one place and it is possible to applicate the same style sheet to multiple pages.
There are three different ways of inserting a style sheet:
- External style sheet
- Internal style sheet
- Inline style
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire web site by changing one file. Each page must link to the style sheet using the
tag or import. This is done by a process in which a style sheet is saved to its own document, and then imported by any page for use with that one. Using this capability, it is possible to create a consistent look for an entire web site in a quick way. Then, if it is needed to change the look of the web site's pages, the changes edited on a single file will be propagated throughout the entire web site automatically.
An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section by using the tag:
An inline style loses many of the advantages of style sheets by mixing content with presentation: the style will be applied just to the styled tag:
<style type="text-css">
hr {color: #ccc;}
p {margin-left: 20px}
body {background-image: url=("images/back.gif)"}
To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. Even multiple external style sheets can be referenced inside a single HTML document. The browser will use first its default style settings, then follows the rules contained in the external file , the internal style and finally the inline style.
So, an inline style (inside an HTML element) has the highest priority , which means that it will override a style declared inside the head tag, in an external style sheet, or in a browser (a default value). By understanding the cascade rules and using them properly, it became possible to create hightly sophisticated sheets that can be changed easily and come together to give the pages a professional look. (examples source: W3schools.com )
If you want to learn more about how web design, xhtml and css can benefit your organisation please contact brightlemon web design london .
By Chiara Consiglio







