XML technologies / ePUB / CSS essentials / Basic syntax

(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)

CSS is, unfortunately, not an XML-based markup language; it has its own syntax, designed to embed concise style information in HTML when needed.

CSS assigns properties to a selector, initially understood as an XML or HTML element. A declaration uses this syntax:

[Selektor] {[Eigenschaft1]: [Wert1]; [Eigenschaft2]: [Wert2]; . . .} 

Braces enclose properties, a colon follows each property name, and a semicolon ends each property/value pair.

Examples follow in the table:

Example

Selector

Property

Value

h1 {color: #0000FF;}

h1

color:

#0000FF

h1 {font-family: ʼTimes New Romanʼ, serif;}

h1

font-family

ʼTimes New Romanʼ, serif

.emphasis {border: 1px solid;}

.emphasis

Border

1px solid

.emphasis {margin: 5px 5px 10px 20px;}

.emphasis

Margin

5px 5px 10px 20px

Table: CSS declaration syntax examples

   

 

 

 

back to top