Custom Search

Wednesday, October 21, 2009

Style Sheets CSS

There is a great deal of information on CSS all over the web. Since it’s a reasonably open web development methodology with lots of options this can quickly lead to confusion and frustration.
What is CSS? CSS is short for Cascading Style Sheets. It is a new web page layout method that has been added to HTML to give web developers more control over their design and content layout. Using CSS allows a designer to create a standard set of commands (either embedded inside the web page or from an external page) that controls the style of all subsequent pages. With CSS you can add style (fonts, colors, spacing, size. links) to web documents. More advanced techniques control the layout of the page without the use of tables or other cumbersome HTML. The most important thing for web designers to understand about CSS is that CSS separates the layout and the styles of a web page. This is often difficult for comprehend for web designers that are used to compiling their creative and HTML coding in a single web page document. Styles such as fonts, font sizes, margins, can be specified in one place, then the Web pages feed off this one master list, with the styles cascading throughout the page or an entire site.
What are the benefits of using CSS? Until recently web page layout was not an exact science. It has been managed by inventive designers who mastered table-based HTML layouts enough to create compelling sites. With CSS all of that has changed as standards are finally being set for the present and future of web design. CSS is beneficial to the designer because of the a fore mentioned control they have over their web site design and how it will be appear across platforms and browsers. Web sites designed in CSS are faster to change and update. Because the coding is reduced the pages are more efficient and require less bandwidth. Cost saving functions like these is causing businesses to demand CSS from their designers which are forcing less hold-out designers to convert because their clients demand it. The main benefit to designers and to companies is that CSS speeds the time it takes to develop and update site layouts. Communication is easier among multiple developers because the workflow is standardized. All in all, CSS is a development method that every designer will be using in the near future, and one that is very beneficial to everyone involved, from the designer through to the end user.
CSS RULES Cascading Style Sheets are a set of rules that govern the display of the document through a web browser. The rules simply are lines of command codes that tell the browser how to display the information. It is crucial with CSS to get the syntax of the command lines correct to keep any frustrating errors from popping up.
What does a rule look like?
The SELECTOR selects (determines) which HTML element you’re working with. HTML elements are common tags like <body>, <H1>,<p>. Often the selector is referred to as an element selector or a type selector. The DECLARATION tells the browser what to do with the Selected element. It consists of two parts: The PROPERTY, which identifies which attribute like font type, size and color, for example, is called into play. The VALUE, determines how the attribute works, in other words it causes the action that changes the font type, size and color to what the property asks for. A declaration is always signaled by a { bracket and is ended with a closing }. A property is separated by a : and a ; ends each declaration. An example of a Declaration:
Why does the code look like this? Browser can read the code in single lines or in staggered lines like the example above. The reason for the staggered line is so our eyes can more easily catch silly errors that can end up costing valuable programming time. Ok, so you're thinking that you could get the same result by just tagging <H1> each with <font color="blue" face="arial">. You could, but what if you have a 20 page site and you want to change the from blue to orange. With one simple change you can change the entire site, and quickly change it back if you hate the new look. That's the beauty of CSS.