This document describes the use of Cascading Style Sheets (CSS) on bbc.co.uk web pages.
CSS allows the separation of content from presentation. At a simple level CSS can be used to style HTML, such as altering text colour, and defining layout. CSS can be used to minimise the code required to render a site. Used with care and particular attention to cross-browser compatibility, style sheets can provide reduced download times and simplify site maintenance.
A full discussion of CSS rules is beyond the scope of this document. Further resources are listed in the References section. This document MAY be more understandable when read in conjunction with the Browser Support Standards and XHTML Integrity Standards.
2.1. CSS MUST be used to specify presentational aspects of page design such as typography, layout, interaction (along with JavaScript) and design features.
2.2. The page MUST be usable and readable without the CSS.A1
2.3. Style sheets SHOULD be tested against all level 1 and level 2 browsers, see Browser Support Standards.A2
2.3.1. In Level 1 browsers the CSS MUST render a fully usable representation of the page design. In level 2 browsers a page MUST be readable and usable, but doesn’t have to completely represent the design.
2.4. Use of CSS MUST be valid according to a published W3C recommendation, UNLESS you need to deviate from this to keep within the BBC Browser Standards.
2.4.1. If you wish to use browser specific syntax, you SHOULD do so in such a way as to limit the impact on future browsers. B1
2.5. The presentation of any page employing CSS MUST degrade gracefully (see: Browser Support Standards) in browsers that do not support, or provide only partial support for certain CSS features.
2.6. Style sheets MUST NOT be used to modify the appearance of the toolbar or global site elements unless is allowed as stated in the Barlesque Standard
2.7. You MUST NOT use !important. A3
3.1. Definitions for this section:
<link> in the <head><style> in the <head><div style=”color:red;”>3.2 External CSS files SHOULD be used in preference to document head CSS and document head CSS SHOULD be used in preference to inline CSS.
3.3. CSS files MUST have the file extension .css and SHOULD be stored in the relevant includes directory in the site structure, usually /style/.
3.4. The file size of CSS files SHOULD be kept as low as possible, especially on high demand pages.A4B2
3.5. External CSS MUST be linked to using the <link> element which MUST be placed in the head section of the document.A5
3.6. External style sheets MUST NOT be imported (i.e. using @import) as it impairs caching. A6
3.7. Document head CSS MAY be used where a style rule is only required for a specific page.
3.8. Inline styles MUST NOT be used.
3.9. Query string data (e.g. "style.css?v=0.1") MUST NOT be used on an external CSS file.A7
4.1. A single generic font-family name MUST be appended to the end of a font statement as a fall-back. This MUST be serif, sans-serif, cursive, or monospace. A8
For example: "helvetica, arial, sans-serif".
4.2. Typographic sizes MUST NOT be specified in units that are not resizable in all browsers such as px and pt, except for in print stylesheets. A9
4.3. Typography SHOULD be sized using em, but MAY be sized in % or keyword values.
4.4. Text MUST be readable when the text size is increased by two steps in any of the Level 1 supported browsers (Note: For browsers that support text resizing, as some only zoom the page). A10 B3
5.1. Link properties SHOULD be set using CSS, including control of the underlining of links where appropriate.
5.2. When styling links the order is important, and as such you SHOULD order them using the LVHA method. B4
6.1 You MUST always define a page background colour in your CSS, even if it is white.A11
6.2 When specifying a text color or a background image, you MUST specify a background color that compliments it and vice versa.A12
6.3 A full default set of definitions for colours (equivalents of text, link, alink, vlink and bgcolor in html) MUST be specified in the page's CSS style-sheet.A13
6.4 Please also refer to the Use of Colour and Colour Contrast Standard.
@import behaves the same as using <link> at the bottom of the page (preventing progressive rendering), so it's best not to use it. See Yahoo's Developer Network document, 'Best Practices for Speeding Up Your Web Site'<link> to avoid the flash of unstyled content (aka FOUC) in IE6<link> and @import has a negative effect on browsers’ ability to asynchronously download the files. See Steve Souders' blog entry, 'don’t use @import.com'
a:link {color:#cc3300; text-decoration:none;}
a:visited {color:#cc3300; text-decoration:none;}
a:hover {color:#0000cc; text-decoration:underline;}
a:active {color:#cc3300; text-decoration:underline;}
a {color:#cc3300; text-decoration:underline;}
For more information see: Eric Meyer, LVHA Hyperlink CSS
BBC © 2014 The BBC is not responsible for the content of external sites. Read more.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.