CSS Syntax
Following rules do apply for CSS styles:
Structure of a CSS Declaration
.myStyle { font-color: black; }
SELECTOR/ ATTRIBUTE VALUE
NAME
Every style starts with the selector followed by an opening curved parenthesis, a number of attribute-value pairs and a closing curved parenthesis. The selector can consist of several item-names and contain an "extends" clause. Each attribute-value pair needs to be finished by a semicolon.
Naming
Styles can use any names, as long as they consist of alphanumeric and underline (_) characters only. Names are not case-sensitive. Static styles need to start with a dot. Static styles must not use the names of dynamic or predefined styles. All Java keywords like "class", "int" or "boolean" etcetera are not allowed as style names.
Grouping of Attributes
Attributes can be grouped for easier handling:
.mainScreen {
font-color: black;
font-size: medium;
font-style: italic;
font-face: system;
}
The above code is equivalent with the following:
.mainScreen {
font {
color: black;
size: medium;
style: italic;
face: system;
}
}
The grouping makes the declarations better readable for humans.
Referring to Other Styles
When another style is referred, the dots of static styles do not need to be written. Styles can be referred in attributes or after the extends keyword in the selector of a style.
Comments
Comments can be inserted at any place and start with "/*" and stop with "*/". Everything between these boundaries is ignored:
/* this style designs the main screen: */
.mainScreen {
/* defining the color of a font: */
font-color: black;
/* sizes are small, medium and large: */
font-size: medium;
/* styles are plain, bold, italic or underlined: */
font-style: italic;
/* the face can either be system, proportional or monospace: */
font-face: system;
}