Adding a style

Create a style website: use the style element, link to separate style sheets, set page margins. HTML+CSS: set the font type, style and size, add borders and backgrounds, set colors with named or numeric values, add style for browsers that don't understand CSS, set left and right and other tricks.

Adding a style

This is a short guide to styling your Web pages. It will show you how to use Cascading Style Sheets language (CSS) as well as alternatives using HTML itself. The route will steer you clear of most of the problems caused by differences between different brands and versions of browsers.

For style sheets to work, it is important that your markup be free of errors. A convenient way to automatically fix markup errors is to use the HTML Tidy utility. This also tidies the markup making it easier to read and easier to edit. I recommend you regularly run Tidy over any markup you are editing. Tidy is very effective at cleaning up markup created by authoring tools with sloppy habits.

The following will teach you how to:

<style

Getting started.

Let's start with setting the color of the text and the background. You can do this by using the STYLE element to set style properties for the document's tags:

ShowLearn more

font

Controlling the font.

This section explains how to set the font and size, and how to add italic, bold and other styles.

ShowLearn more

<div

Adding borders and backgrounds.

You can easily add a border around a heading, list, paragraph or a group of these enclosed with a div element. For instance:

ShowLearn more

color:

Setting Colors.

Some examples for setting colors appeared in earlier sections. Here is a reminder:

ShowLearn more

<body

What about browsers that don't support. CSS?

Older browsers, that is to say before Netscape 4.0 and Internet Explorer 4.0, either don't support CSS at all or do so inconsistently.

ShowLearn more

www.w3.org, Dave Raggett

» Send question

Author:

E-mail:

Home

Coolf

Websites

Positioning

Cooperation

About

Contact