5. Syntax Rules of WCSS
The syntax rules of WCSS are not difficult to learn. A WCSS statement is consisted of a selector, a property, and a property value. The selector specifies the element(s) affected by the style rule. Typically, the selector is the XHTML MP element that you want to apply the style to (there are other types of selectors and they will be covered later at "Different Types of Selectors"). The property specifies the style you want to set. The property value is the value that you assign to a certain property. The syntax of a WAP CSS statement is like this:
selector {property: property_value}
This is an example of a WAP CSS statement:
p {text-align: right}
The above style statement tells the WAP browser to align the text enclosed within all <p></p> tags to the right horizontally.
Multiple properties are separated with a semicolon. The syntax is like this:
selector {property1: property_value1; property2: property_value2; ... propertyN: property_valueN}
Below is another WCSS example. The style statement tells the WAP browser to align the text enclosed within all <p></p> tags to the right and change the text color to blue.
p {text-align: right; color: blue}
Specifying more than one selector is allowed. A comma is used to separate the selectors. The syntax is like this:
selector1, selector2, ... selectorN {property1: property_value1}
Let's have a look at another WCSS example. The style statement below will cause the text enclosed in all <p></p> and <h1></h1> tag pairs to be aligned to the right horizontally and shown in blue color.
p, h1 {text-align: right; color: blue}
6. Comments in WCSS
In WCSS, comments are enclosed within /* and */. WAP browsers ignore all comments. This example demonstrates the use of comments in WCSS:
p
{
/* A single line comment in WAP CSS */
/* A multi-line
comment
in WAP CSS */
text-align: right; /* A comment
can be placed at the end of a line. */
color: blue
}
Previous Page | Page 3 of 39 | Next Page |
- 1. WCSS (WAP CSS) Introduction
- 2. Wireless CSS and Wireless Profile CSS
- 3. Advantages of Using WAP CSS Style Sheets on Mobile Internet Sites
- 4. Disadvantages of Using WAP CSS Style Sheets on Mobile Internet Sites
- 5. Syntax Rules of WCSS
- 6. Comments in WCSS
- 7. How to Apply WCSS Styles to an XHTML MP Document
- 8. Different Types of Selectors
- 9. Div and Span Element of XHTML MP
- 10. Cascading Rules for Handling Multiple Groups of WCSS Styles Applied to the Same Element
- 11. Common Types of Property Value
- 12. WCSS Font and Text Properties
- 13. WCSS List Properties
- 14. WCSS Color Properties
- 15. WCSS Border Properties
- 16. WAP Specific Extensions to CSS
- 17. WCSS Access Key Extension
- 18. WCSS Input Extension
- 19. WCSS Marquee Extension
- 20. Matching WCSS Cascading Style Sheets to Different User Agents