Style sheet (web development)

Short description: Form of separation of content and presentation for web design

Cascading Style Sheets

* Style sheet
* CSS Zen Garden
* The Zen of CSS Design

Concepts

* box model
* image replacement
* flexbox
* grid

Philosophies

* Tableless
* Responsive
* "Holy grail"

Tools

* Sass
* Less
* Stylus
* CSSTidy

Comparisons

* CSS support
* Stylesheet languages

* Cascading Style Sheets

* v
* t
* e

HTML

* Dynamic HTML
* HTML5
* audio
* canvas
* video
* XHTML
* Basic
* Mobile Profile
* C-HTML
* HTML element
* span and div
* HTML attribute
* HTML frame
* HTML editor
* Character encodings
* Unicode
* Language code
* Document Object Model
* Browser Object Model
* Style sheets
* CSS
* Font family
* Web colors
* HTML scripting
* JavaScript
* WebGL
* WebCL
* W3C
* Validator
* WHATWG
* Quirks mode
* Web storage
* Rendering engine

Comparisons

* Document markup languages
* HTML support
* XHTML
* 1.1

A web style sheet is a form of separation of content and presentation for web design in which the markup (i.e., HTML or XHTML) of a webpage contains the page's semantic content and structure, but does not define its visual layout (style). Instead, the style is defined in an external style sheet file using a style sheet language such as CSS or XSLT. This design approach is identified as a "separation" because it largely supersedes the antecedent methodology in which a page's markup defined both style and structure.

The philosophy underlying this methodology is a specific case of separation of concerns.

## Contents

* 1 Benefits
* 1.1 Speed
* 1.2 Maintainability
* 1.3 Accessibility
* 1.4 Customization
* 1.5 Consistency
* 1.6 Portability
* 2 Practical disadvantages today
* 2.1 Narrow adoption without the parsing and generation tools
* 3 See also
* 4 References
* 5 External links

## Benefits

Separation of style and content has advantages,[1][2] but has only become practical after improvements in popular web browsers' CSS implementations.

### Speed

Overall, users experience of a site utilising style sheets will generally be quicker than sites that don’t use the technology. ‘Overall’ as the first page will probably load more slowly – because the style sheet AND the content will need to be transferred. Subsequent pages will load faster because no style information will need to be downloaded – the CSS file will already be in the browser’s cache.

### Maintainability

Holding all the presentation styles in one file can reduce the maintenance time and reduces the chance of error, thereby improving presentation consistency. For example, the font color associated with a type of text element may be specified — and therefore easily modified — throughout an entire website simply by changing one short string of characters in a single file. The alternative approach, using styles embedded in each individual page, would require a cumbersome, time consuming, and error-prone edit of every file.

### Accessibility

Sites that use CSS with either XHTML or HTML are easier to tweak so that they appear similar in different browsers (Chrome, Internet Explorer, Mozilla Firefox, Opera, Safari, etc.).

Sites using CSS "degrade gracefully" in browsers unable to display graphical content, such as Lynx, or those so very old that they cannot use CSS. Browsers ignore CSS that they do not understand, such as CSS 3 statements. This enables a wide variety of user agents to be able to access the content of a site even if they cannot render the style sheet or are not designed with graphical capability in mind. For example, a browser using a refreshable braille display for output could disregard layout information entirely, and the user would still have access to all page content.

### Customization

If a page's layout information is stored externally, a user can decide to disable the layout information entirely, leaving the site's bare content still in a readable form. Site authors may also offer multiple style sheets, which can be used to completely change the appearance of the site without altering any of its content.

Most modern web browsers also allow the user to define their own style sheet, which can include rules that override the author's layout rules. This allows users, for example, to bold every hyperlink on every page they visit. Browser extensions like Stylish and Stylus have been created to facilitate management of such user style sheets.

### Consistency

Because the semantic file contains only the meanings an author intends to convey, the styling of the various elements of the document's content is very consistent. For example, headings, emphasized text, lists and mathematical expressions all receive consistently applied style properties from the external style sheet. Authors need not concern themselves with the style properties at the time of composition. These presentational details can be deferred until the moment of presentation.

### Portability

The deferment of presentational details until the time of presentation means that a document can be easily re-purposed for an entirely different presentation medium with merely the application of a new style sheet already prepared for the new medium and consistent with elemental or structural vocabulary of the semantic document. A carefully authored document for a web page can easily be printed to a hard-bound volume complete with headers and footers, page numbers and a generated table of contents simply by applying a new style sheet.

## Practical disadvantages today

Currently specifications (for example, XHTML, XSL, CSS) and software tools implementing these specification are only reaching the early stages of maturity. So there are some practical issues facing authors who seek to embrace this method of separating content and style.

### Narrow adoption without the parsing and generation tools

While the style specifications are quite mature and still maturing, the software tools have been slow to adapt. Most of the major web development tools still embrace a mixed presentation-content model. So authors and designers looking for GUI based tools for their work find it difficult to follow the semantic web method. In addition to GUI tools, shared repositories for generalized style sheets would probably aid adoption of these methods.

## See also

* Separation of concerns

## References

1. ↑ Why use CSS? - Web developer guide | MDN
2. ↑ Why Use CSS in Website Design

## External links

* CSS Zen Garden: A site which challenges designers to create new page layouts without touching the XHTML source. Includes dozens of layouts. CSS source can be viewed for every layout.

* v
* t
* e

Style sheet languages

Modes|

* Desktop publishing
* Web development
* User interfaces

Standard|

* Cascading (CSS)
* DSSSL
* Extensible (XSL)

Preprocessor|

* JavaScript (JSSS)
* FOSI
* Qt
* Sass
* Less
* Stylus
* SMIL Timesheets
* PostCSS

* List
* Comparison

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Style sheet (web development). Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Style_sheet_(web_development)&oldid=241056"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template