News Tutorials Projects Reviews Authors Contact Search Links Admin
 

CSS Introduction : CSS Syntax

Example 1

A basic example of CSS syntax might be:
h1 {
	font-size: 16pt;
	font-family: Arial, Verdana, sans-serif;
	color: black;
	background-color: yellow;
}

CSS Example

This is CSS syntax to set the properties of a <h1> tag.
- The font size is 16pt.
- The font face is Arial.
-- Verdana and sans-serif are sub fonts, used when the first font isn't found.
- The color is black.
- The background colour is yellow.

Note:

Pretty simple so far? Well it doesn't get much harder.

Basically, you name your tag type, add some curly brackets { } and type the properties you want inbetween.

Properties have the syntax: property-name: value;
Starting with the property name followed by a colon, then the value, then a semi-colon to close the line.

For a full list of CSS properties, and a wealth of other information.. visit Blooberry.com. I'm always visiting this website to check up on bits and pieces.

Example 2

So, another example, say we want to set the colour of our links to red, and remove the annoying underline?
a {
	color: #CC0010;
	text-decoration: none;
}
Example CSS

Pretty straight forward. We're using <a> as the tag name.
- Set the color to a HEX value (red, no green, with a little blue)
- Set text-decoration to none.
Note: You can use 'text-decoration: underlined;' to force underlining.

That covers the very basics, but of course theres alot more you can do with CSS. Go to the next page to see how we use CSS alongside HTML.

 


Author: Markavian
Last edited on: 5th Dec, 6:53 pm
Please rate this article.

« Prev page 'Introduction' « » Next Page 'CSS in HTML' »

tutorial Pages