Cascading Style Sheets { CSS}
Cascading Style Sheets (CSS) is a stylesheet language used to describe the bestowal of a document written in a markup language. Its most trite petition is to word choice web pages written in HTML and XHTML, but the jargon can be applied to any kind of XML document, including SVG and XUL.
CSS can be familiar locally by the readers of snare pages to explain colors, fonts, layout, and other aspects of document presentation. It is designed basically to license the separation of document content from document presentation .This separation can improve substance accessibility, contribute more flexibility and hold back in the specification of presenting characteristics, and adjust complexity and repetition in the structural content. CSS can also allow the anyhow markup servant to be presented in different styles for contrary rendering methods, such as on-shroud, in type, by voice and on Braille-based, tactile devices. CSS specifies a priority disposition to determine which look rules make application if more than one prevail matches against a particular element. In this so-called cascade, priorities or weights are calculated and assigned to rules, so that the results are expected.
This entry was posted
on Monday, July 14th, 2008 at 8:48 am and is filed under Web design.
Comments are closed.
04Feb 08
Cascading Style Sheets (CSS)
Introduction
Recently, I've seen quite a few websites that do not implore any type of stylesheet, or organizational structure to their patterns. This is exclusive on the other hand poor coding practices, in my opinion, but it also produces a site of slipshod value and makes it harder for peole who fancy to read the source pandect to find d‚mod‚ what it event. On the other end, there are people who use CSS without a well-rounded acquaintance of what it does, and thus they never reach the limits of what CSS can do. Pratices like table layouts, multiple use of the font color/scope attribute, and other coding pratices can be cut out of unwritten law' with anyone simple style coating. I hope that in review this blog I will be talented to reach to the greater community and hopefully plagiarize upon a greater truce of CSS for others.
What is CSS?
Cascading tag Sheets, or CSS for short, is a easy to necessity coding pattern that adds style (font attributes, spacing, etc.) to your Website. To most stock application bearing is to style web pages using HTML and XHTML, but it is possible to avail oneself of the langauge in multiple types of XML documents. With CSS a user can seperate their document content from certificate donation, thus improving the text accessibility and making it easier to change styles from one source. The CSS specifictations are maintatined by the cosmos Wise Web Consortium (W3C), and uses the mime type text/css which is registered for from by CSS by RFC2318.
History
Having a stark armistice of CSS is not adequacy to truely appreciate the use of Stylesheets. qualified where CSS comes from, what sparked the conception/need in place of it, and how it has helped the World broad Web community will cause to grow a depper understanding of stylesheets and will compel you to take replete betterment of it when the time comes.
in the beginning it is prudent to know that label sheets have existed since SGML in the 1970's. As HTML grew in popularity, it began to inundate a wider heterogeneity of styling features that would help handle the demands of the World Wide snare community. This growth gave designers moer control beyond their locate apperance, but also resulted in more complex, and harder to sustain, HTML code. To make matters worse for developers, a variation in web browsers made it bordering on unimaginable to have your site look unswerving across multiple browser platforms, and gave users less control down how network content was displayed.
In order to better the capabilities of network show, nine different sheet langauges were proposed to the W3C's www-style mailing list. Out of those nine proposals, two were chosen as the foundation for what became CSS; Cascading HTML mode Sheets (CHSS) and rush-based Style Sheet Prposal (SSP).
Thus, through a amalgamation of the two, CSS was born.
Unline existing style languages like DSSSL and FOSI, CSS allowed a validate's style to be influenced by multiple look sheets. whole rage veneer could receive or "cascade" from another, permitting a mixture of stylistic preferances controlled equally by the orientation draughtsman and user.
Although the CSS1 itemization was completed in 1996 and Microsoft's Internet Explorer 3 was released in that year featuring some limited reinforcing on account of CSS, it would be more than three years rather than any entanglement browser achieved near-intense implementation of the specifcation. I.E. 5.0 fror the Macintosh, shippped in walk of 2000, was the first browser to have full support of CSS1, surpassing Opera, which had been the bossman since its introduction of CSS support fiften years before. As of July 2006, no browser has fully implemented CSS2, which implementation levels vary.
Syntax
CSS has a simple syntax, and uses a number of English keywords to mention the names of various style properties. Each style sheet consists of a list of rules, where each principle or rule-fix consists of one or more selectors and a notice block. A proclamation-hunk consists of a list of semicolon-terminated declarations in curly braces. Each declaration itself consists of a idiosyncrasy, a colon, a value, then a semi-colon.
In CSS, selectors are utilized to declare which elements a type applies to. Selectors may apply to all elements of a typical of order, or just those elements which match certain attritubles.
In addition to these, a tackle of pseudo-classes can be used to define futher conduct. A pseudo class selcts undiminished elements, such as :link or :visited, whereas a pseudo-unit makes a selection that may consist of partial elements.
forward of CSS, approximately all of the presentational attributes of HTML documents contained within the HTML markup the font colors, background styles, element alignments, borders and sizes, etc. CSS allows you to shake up much of that information to a separate stylesheet resulting in a considerably simpler HTML page.
in behalf of example, the heading tags (h1, h2, h3, etc) were all predefined sizes structurally using HTML. If a designer wished to speculation the value he/she then had to use the HTML font dub, and other presentational elements, for each occurrence of that headign type. Thus, each time H2 was called, the user also had to add the code to render it in the perferred purpose. With the creation of CSS, presentation is seperated from structure. then, you submit the design of h2 once in your stylesheet, and watch as everytime h2 is called in your HTML it inherits the desired design declared in the stylesheet.
Limitations
Some notorious disadvantages of using "maidenly" CSS, as stated by the W3C, take in:
Inconsistent browser reinforcing
Different browsers force execute CSS layout differently as a be produced end of browser bugs or deficit of support for CSS features. because norm Microsoft Internet Explorer, whose older versions, as IE 6.0, lacked many CSS 2.0 properties, misinterpreted a significant party of important properties, such as bore, height, and waft. Numerous so-called CSS "hacks" be compelled be implemented to achieve predictable layout among the most commonplace or commonly tempered to user agents (browsers). Pixel authentic layouts can sometimes be unsuitable to achieve across browsers.
Selectors are unable to ascend
CSS offers no way to finest a father or forefather of factor that satisfies certain criteria. A more advanced selector plot (such as XPath) would enable more sophisticated stylesheets. degree, the major reasons looking for the CSS Working Group rejecting proposals for materfamilias selectors are kin to browser performance and incremental delineation issues.
undivided block ukase cannot explicitly inherit from another
Inheritance of styles is performed by the browser based on the containment hierarchy of DOM elements and the specificity of the ordinarily selectors, as suggested by the section 6.4.1 of the CSS2 particularization. the user of the blocks can refer to them by including lineage names into the grade quality of a DOM foundations.
Vertical control limitations
While horizontal ordering of elements is generally easy to control, vertical placement is every so often unintuitive, convoluted, or impossible. guileless tasks, such as centering an element vertically or getting a footer to be placed no higher than bottom of viewport, either require intricate and unintuitive style rules, or common but widely unsupported rules.
Absence of expressions
There is currently no cleverness to spell out gear values as simple expressions (such as compass-socialistic: 10% - 3em + 4px;). However, a working design with a calc() value to address this limitation has been published by the CSS WG, and Internet Explorer 5 and all later versions support a proprietary word() statement, with similar functionality.
Lack of orthogonality
Multiple properties on numerous occasions put an end to up doing the same task. For instance, point of view, show and float define the placement model, and most of the time they cannot be combined meaningfully. A display: eatables-cell sphere cannot be floated or given position: relative, and an essential with float: port side should not behave to changes of show. In furthermore, some properties are not defined in a flexible way that avoids birth of new properties. fitted sample, you should ingest the "border-spacing" property on table element instead of the "compass-*" property on victuals cell elements. This is because according to the CSS condition, internal table elements do not get margins.
Margin collapsing
Margin collapsing is, while well-documented and useful, also complicated and is frequently not expected by authors, and no dumb side-effect-freely in the capacity of is at one's fingertips to control it.
Float containment
CSS does not explicitly offer any real estate that would push an element to curb floats. Multiple properties tender this functionality as a side effect, but not one of them are completely pilfer in all situations. As there will be an overflow when the elements, which is contained in a container, squander set up property. habitually, postulate: conditioned by does solve this. Floats will be different according to the web browser size and resolution, but positions can not.
Lack of multiple backgrounds per territory
Highly graphical designs make several background images seeking every element, and CSS can brace only one. ergo, developers have to decide between adding redundant wrappers around document elements, or dropping the visual effect. This is partially addressed in the working draft of the CSS3 backgrounds module, which is already supported in Safari and Konqueror.
Control of Element Shapes
CSS currently only offers rectangular shapes. Rounded corners or other shapes may require non-semantic markup. in any event, this is addressed in the working delineate of the CSS3 backgrounds module.
deficit of Variables
CSS contains no variables.
paucity of column pronouncement
While possible in current CSS, layouts with multiple columns can be complex to implement. With the trend CSS, the process is time after time done using floating elements which are repeatedly rendered differently by different browsers, contrastive computer screen shapes, and remarkable screen ratios set on standard monitors.
Conclustion
As you can see, though CSS has its limitations, it provides designers with the tools needed to compensate for better sites, easier to peruse code, cleaner HTML markup, and much more. It is my hopes that in reading this introduction to CSS, that designers pass on deem the trouble to piece of equipment the system into their designs, and dream up improve signs and more readable and easier to maintaitn code.
This entry was posted
on Monday, February 4th, 2008 at 1:00 am and is filed under Web design.