What you need to know about CSS !

What you need to know about CSS!network traffic and noticeably quicker page
Style sheet is a progressive breakthrough for thedownloads.
advancement of web. Today, more and moreFor example, the HTML element h2 specifies that the
browsers are implementing style sheets, openingtext contained within it is a level two heading. It has
authors' eyes to unique features that allow influencea lower level of importance than h1 headings, but a
over presentation while preserving platformhigher level of importance than h3 headings. This
independence. The advantages of style sheets haveaspect of the h2 element is structural .
become - apparent -- and the disadvantage ofCustomarily, headings are rendered in decreasing
continually creating more HTML tags -- galore -- fororder of size, with h1 as the largest, because larger
presentation effects with the gradual developmentheadings are usually interpreted to have greater
of CSS.importance than smaller ones. Headings are also
Let's understand CSS in the right perspective.typically rendered in a bold font in order to give them
Style sheets in retrospectadditional emphasis. The h2 element may be rendered
Style sheets have been around in one form orin bold face, and in a font larger than h3 but smaller
another since the beginnings of HTML in the earlythan h1 . This aspect of the h2 element is
1990s .presentational .
As the HTML language grew, however, it came toPrior to CSS, document authors who wanted to
encompass a wider variety of stylistic capabilities toassign a specific color, font, size, or other
meet the demands of web developers . With suchcharacteristic to all h2 headings had to use the HTML
capabilities, style sheets became less important, andfont element for each occurrence of that heading
an external language for the purposes of definingtype.
style attributes was not widely accepted until theMoreover, CSS can be used with XML, to allow such
development of CSS.structured documents to be rendered with full
Teething problems with implementation of CSSstylistic control over layout, typography, color, and so
Many implementations of CSS are fraught withforth in any suitable user agent or web browser.
inconsistencies, bugs and other quirks . Authors haveCSS has its share of inconsistencies as well
commonly had to use hacks and workarounds inCSS may at times be misused, particularly by the
order to obtain consistent results across webauthor of web documents. Some developers who
browsers and platforms .are accustomed to designing documents strictly in
One of the most well-known CSS bugs is theHTML may overlook or ignore the enabling features
Internet Explorer box model bug; box widths areof CSS. For instance, a document author who is
interpreted incorrectly in several versions of thecomfortable with HTML markup that mixes
browser, resulting in blocks which appear aspresentation with structure may opt to use strictly
expected in most browsers, but are too narrowembedded CSS styles in all documents. While this
when viewed in Internet Explorer. The bug can bemay be an improvement over using deprecated
avoided, but not without some cost in terms ofHTML presentational markup, it suffers from some of
functionality.the same problems that mixed-markup HTML does;
This is just one of hundreds of CSS bugs that havespecifically, it entails a similar amount of document
been documented in various versions of Internetmaintenance.
Explorer, Netscape, Mozilla, and Opera many of whichDiscrepancies compared: CSS vs programming
reduce the legibility of documents. The proliferationlanguages
of such bugs in CSS implementations has made itCSS also shares some pitfalls common with
difficult for designers to achieve a consistentprogramming languages. In particular, the problem of
appearance across platforms.choosing appropriate names for CSS classes and
Currently there is strong competition betweenidentifiers may afflict CSS authors. In the attempt to
Mozilla's Gecko layout engine, Opera's Presto layoutchoose descriptive names for CSS classes, authors
engine , and the KHTML engine used in both Apple'smight associate the class name with desired
Safari and the Linux Konqueror browsers - each ofpresentational attributes; for example, a CSS class to
them is leading in different aspects of CSS. Internetbe applied to emphasized text might be named
Explorer remains the worst at rendering CSS by"bigred," implying that it is rendered in a large red
standards set down by World Wide Web Consortiumfont.
as of 2005 .While such a choice of naming may be intuitive to the
Some breakthroughs ...document author, it can cause problems if the author
These problems have preisely led the W3C to reviselater decides that the emphasized text should instead
the CSS2 standard into CSS2.1, which may bebe green; the author is left with a CSS class called
regarded as something of a working snapshot of"bigred" that describes something that is green. In
current CSS support. CSS2 properties which nothis instance, a more appropriate class name might
browser had successfully implemented were dropped,have been "emphasized," to better describe the
and in a few cases, defined behaviours werepurpose or intent of the class, rather than the
changed to bring the standard into line with theappearance of elements of that class.
predominant existing implementations..In a programming language, such a misuse might be
What makes style sheets significant enough?etanalogous to using a variable name "five" for a
representsStyle she an enormous step forward forvariable which contains the value 5; however, if the
the Web. With the separation of content andvalue of the variable changes to 7, the name is no
presentation between HTML and style sheets, thelonger appropriate.
Web no longer needs to drift away from the strongCSS in a nutshell
ideal of platform independence that provided theCSS is used by both the authors and readers of web
medium with its initial push of popularity. Authors canpages to define colors, fonts, layout and other
finally influence the presentation of documentsaspects of document presentation. It is designed
without leaving pages unreadable to usersprimarily to enable the separation of document
A style sheet is made up of style rules that tell astructure (written in HTML or a similar markup
browser how to present a document. There arelanguage) from document presentation (written in
various ways of linking these style rules to yourCSS).
HTML documents, but the simplest method forThis separation provides a number of benefits,
starting out is to use HTML's STYLE element. Thisincluding improved content accessibility, greater
element is placed in the document HEAD, and itflexibility and control in the specification of
contains the style rules for the page.presentational characteristics, and reduced complexity
Functionality and Usage of CSSof the structural content. CSS is also capable of
CSS is well-designed to allow the separation ofcontrolling the document's style separately in
presentation and structure. Prior to CSS, nearly all ofalternative rendering methods, such as on-screen in
the presentational attributes of an HTML documentprint, by voice (when read out by a speech-based
were contained within the HTML code; all font colors,browser or screen reader) and on braille-based, tactile
background styles, element alignments, borders anddevices.
sizes had to be explicitly described, often repeatedly,CSS allows complete and total control over the style
in the midst of the HTML code.of a hypertext document. The only way this can be
CSS allows authors to move much of thatillustrated in a way that gets people excited is by
information to a stylesheet, resulting in considerablydemonstrating what it can truly be, once the reins
simpler HTML code. The HTML documents becomeare placed in the hands of those able to create
much smaller and web browsers will usually cachebeauty from structure.
sites' CSS stylesheets. This leads to a reduction in