Using CSS (Cascaded Style Sheets) to Create Clear ContentThis document shows some ideas for using CSS to create clear content. This document is a first working draft only. It has been created to test ideas and promote discussion. If you have any comments or would like to participate in this effort email us or join LD web guidelines list. IntroductionCSS is a very useful tool for creating clear and usable web pages. You can use CSS for highlighting any important concepts and the structure of your page. Reusing your style sheets keeps the layout consistent across your pages and helps users learn and anticipate how styles are used. Techniques1 Set "easy to read" style defaults for your page
1.1 Use white space to separate ideas and paragraphs.Aligning text to the right to the left (in a left to right language) . This is easier to read than right justified text.
CSS examplep{text-indent:145px; padding-bottom:1em; padding-top:1em; text-align: left; } Code explanation:
1.2 Use a clear default font such as Arial or Comic Sans.CSS examplebody{ font-family: Arial;} 1.3 Use colored paper instead of white. Cream or off-white provides a good alternative. In all CSS examples keep a high contrast between the background and foreground.CSS examplebody{background-color: #ffff99; color: black; } 2 Help the user follow the structure of the documentYou do not want too many colors and font sizes used on a page. However, changing colors and size of fonts can help people follow the structure of your pages. For example, use a different color for each heading level on your site. CSS exampleh1
h2 Note: For this to work well the main HTML document must have had headings tagged consistently as headings. Also, the correct heading level should have been used, such as the h1 tag for all headings of level one. 3 Making important text stand out and highlight key concepts.3.1 Using CSS classesIn general, to use CSS well you want to create CSS classes for types of content that have a similar role. For example, you can create a CSS class for warnings, notes, examples or any other type of text that have similar roles. Then you can easily make each type of text stand out. At the same time, you can make it clear to the user what they need to look at and what it represents. Avoid italics which are harder to read. Avoid all capitalized sentences as these are also harder to read. 3.2 BoxesA good mechanisim for making text stand out is putting a box around very important content. CSS exampleP.warning{border:1px solid black;} will put a box around any paragraphs that have a class warning. 3.3 PicturesAnother excellent way to help people follow your site is to use pictures and symbols. In this example each paragraph with a class warning will have a picture of an exclamation mark before it. In this example headings level 4 with a class of tool has a background image of a tool. The text has been indented so it will not write over the picture. CSS exampleh4.tools { background-image: url("tools.bmp"); background-position:0 0; background-repeat: no-repeat; text-indent:60px; line-height:250%; }LD web standard CSS classesCSS classes can also be used to alert the user or the assistive technology that sections of text have a given or known role and should be treated differently. Summary of LD web standard CSS classes
|