What you need to know about CSS !

Style sheet is a progressive breakthrough for thenetwork traffic and noticeably quicker page
advancement of web. Today, more and moredownloads.
browsers are implementing style sheets, openingFor example, the HTML element h2 specifies that the
authors' eyes to unique features that allow influencetext contained within it is a level two heading. It has
over presentation while preserving platforma lower level of importance than h1 headings, but a
independence. The advantages of style sheets havehigher level of importance than h3 headings. This
become - apparent -- and the disadvantage ofaspect of the h2 element is structural .
continually creating more HTML tags -- galore -- forCustomarily, headings are rendered in decreasing
presentation effects with the gradual developmentorder of size, with h1 as the largest, because larger
of CSS.headings are usually interpreted to have greater
Let's understand CSS in the right perspective.importance than smaller ones. Headings are also
Style sheets in retrospecttypically rendered in a bold font in order to give them
Style sheets have been around in one form oradditional emphasis. The h2 element may be rendered
another since the beginnings of HTML in the earlyin bold face, and in a font larger than h3 but smaller
1990s.than h1 . This aspect of the h2 element is
As the HTML language grew, however, it came topresentational .
encompass a wider variety of stylistic capabilities toPrior to CSS, document authors who wanted to
meet the demands of web developers . With suchassign a specific color, font, size, or other
capabilities, style sheets became less important, andcharacteristic to all h2 headings had to use the HTML
an external language for the purposes of definingfont element for each occurrence of that heading
style attributes was not widely accepted until thetype.
development of CSS.Moreover, CSS can be used with XML, to allow such
Teething problems with implementation of CSSstructured documents to be rendered with full
Many implementations of CSS are fraught withstylistic control over layout, typography, color, and so
inconsistencies, bugs and other Authors haveforth in any suitable user agent or web browser. CSS
commonly had to use hacks and workarounds inhas its share of inconsistencies as well
order to obtain consistent results across webCSS may at times be misused, particularly by the
browsers and platforms.author of web documents. Some developers who
One of the most well-known CSS bugs is theare accustomed to designing documents strictly in
Internet Explorer box model bug; box widths areHTML may overlook or ignore the enabling features
interpreted incorrectly in several versions of theof CSS. For instance, a document author who is
browser, resulting in blocks which appear ascomfortable with HTML markup that mixes
expected in most browsers, but are too narrowpresentation with structure may opt to use strictly
when viewed in Internet Explorer. The bug can beembedded CSS styles in all documents. While this
avoided, but not without some cost in terms ofmay be an improvement over using deprecated
functionality.HTML presentational markup, it suffers from some of
This is just one of hundreds of CSS bugs that havethe same problems that mixed-markup HTML does;
been documented in various versions of Internetspecifically, it entails a similar amount of document
Explorer,Netscape Mozilla , and Opera, many of whichmaintenance.
reduce the legibility of documents. The proliferationDiscrepancies compared: CSS vs programming
of such bugs in CSS implementations has made itlanguages
difficult for designers to achieve a consistentCSS also shares some pitfalls common with
appearance across platforms.programming languages. In particular, the problem of
Currently there is strong competition betweenchoosing appropriate names for CSS classes and
Mozilla's Gecko layout engine, Opera's Presto layoutidentifiers may afflict CSS authors. In the attempt to
engine, and the KHTML engine used in both Apple'schoose descriptive names for CSS classes, authors
Safari and the Linux Konqueror browsers - each ofmight associate the class name with desired
them is leading in different aspects of CSS. Internetpresentational attributes; for example, a CSS class to
Explorer remains the worst at rendering CSS bybe applied to emphasized text might be named
standards set down by World Wide Web Consortium"bigred," implying that it is rendered in a large red
as of 2005.font.
Some breakthroughs ...While such a choice of naming may be intuitive to the
These problems have preisely led the W3C to revisedocument author, it can cause problems if the author
the CSS2 standard into CSS2.1, which may belater decides that the emphasized text should instead
regarded as something of a working snapshot ofbe green; the author is left with a CSS class called
current CSS support. CSS2 properties which no"bigred" that describes something that is green. In
browser had successfully implemented were dropped,this instance, a more appropriate class name might
and in a few cases, defined behaviours werehave been "emphasized," to better describe the
changed to bring the standard into line with thepurpose or intent of the class, rather than the
predominant existing implementations..appearance of elements of that class.
What makes style sheets significant enough?In a programming language, such a misuse might be
Style sheet represents an enormous step forwardanalogous to using a variable name "five" for a
for the Web. With the separation of content andvariable which contains the value 5; however, if the
presentation between HTML and style sheets, thevalue of the variable changes to 7, the name is no
Web no longer needs to drift away from the stronglonger appropriate.
ideal of platform independence that provided theCSS in a nutshell
medium with its initial push of popularity. Authors canCSS is used by both the authors and readers of web
finally influence the presentation of documentspages to define colors, fonts, layout, and other
without leaving pages unreadable to usersaspects of document presentation. It is designed
A style sheet is made up of style rules that tell aprimarily to enable the separation of document
browser how to present a document. There arestructure (written in HTML or a similar markup
various ways of linking these style rules to yourlanguage) from document presentation (written in
HTML documents, but the simplest method forCSS).
starting out is to use HTML's STYLE element. ThisThis separation provides a number of benefits,
element is placed in the document HEAD, and itincluding improved content accessibility, greater
contains the style rules for the page.flexibility and control in the specification of
Functionality and Usage of CSSpresentational characteristics, and reduced complexity
CSS is well-designed to allow the separation ofof the structural content. CSS is also capable of
presentation and structure. Prior to CSS, nearly all ofcontrolling the document's style separately in
the presentational attributes of an HTML documentalternative rendering methods, such as on-screen in
were contained within the HTML code; all font colors,print, by voice (when read out by a speech-based
background styles, element alignments, borders andbrowser or screen reader) and on braille based, tactile
sizes had to be explicitly described, often repeatedly,devices.
in the midst of the HTML code.CSS allows complete and total control over the style
CSS allows authors to move much of thatof a hypertext document. The only way this can be
information to a stylesheet, resulting in considerablyillustrated in a way that gets people excited is by
simpler HTML code. The HTML documents becomedemonstrating what it can truly be, once the reins
much smaller and web browsers will usually cacheare placed in the hands of those able to create
sites' CSS stylesheets. This leads to a reduction inbeauty from structure.