Write a CSS Syntax
Category: CSS, CSS 2 Tutorial, CSS Examples, CSS Tutorials, CSS3 Tutorial | 456 views | Add a Comment |
The syntax for CSS is different than that of (X)HTML markup. Though it is not too confusing, once you take a look at it. It consists of only 3 parts.
selector { property: value }
The selector is the (X)HTML element that you want to style. The property is the actual property title, and the value is the style you apply to that property.
Each selector can have multiple properties, and each property within that selector can have independent values. The property and value are separated with a colon and contained within curly brackets. Multiple properties are separated by a semi colon. Multiple values within a property are sperated by commas, and if an individual value contains more than one word you surround it with quotation marks. As shown below.
body {
background: #eeeeee;
font-family: “Trebuchet MS”, Verdana, Arial, serif;
}
As you can see in the above code I have separated the color from the font-family with a semi-colon, separated the various fonts with commas and contained the “Trebuchet MS” within quotations marks. The final result sets the body color to light grey, and sets the font to ones that most users will have installed on there computer. Read more…
- Top 15 CSS articles
- 150 CSS Examples
- How to design css sitemap Tree
- CSS tricks
- How CSS3 works
- Benefits of CSS
- What it’s all about CSS3
- CSS QUOTES
- CSS Universal (*) Selector
- CSS3 Multi Column Feature




