XML technologies / ePUB / CSS essentials / Important CSS properties / Positioning

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

The table lists the main CSS properties for element positioning, with possible values and an example each.

left

Distance from the left edge

Defines the distance from the left edge. Only with position.

Values

<Länge> | <Prozent> | auto | inherit

Example

position: absolute; right: 10pt;

top

Distance from the top edge

Specifies the distance from the top edge.

Values

<Länge> | <Prozent> | auto | inherit

Example

position: absolute; top: 2cm;

right

Distance from the right edge

Specifies the distance from the right edge.

Values

<Länge> | <Prozent> | auto | inherit

Example

position: absolute; right: 50px;

bottom

Distance from the bottom of the webpage

Only with position. Specifies the distance from the bottom edge.

Values

<Länge> | <Prozent> | auto | inherit

Example

position: absolute; bottom: 45mm;

clear

Ends float effects

The property clear cancels an earlier float (text wrapping). Values:

1) left: no wrapping from the left

2) right: no wrapping from the right

3) both: no wrapping from either side

Values

none | left | right | both | inherit

Example

clear: right;

max-width

Maximum width

Defines an element’s maximum permitted width.

Values

<Länge> | <Prozent> | none | inherit

Example

max-width: 90%;

max-height

Maximum height

Defines an element’s maximum permitted height.

Values

<Länge> | <Prozent> | none | inherit

Example

max-height: 200px;

min-width

Minimum width

Defines an element’s minimum width.

Values

<Länge> | <Prozent> | inherit

Example

min-width: 11cm;

min-height

Minimum height

Defines an element’s minimum height.

Values

<Länge> | <Prozent> | inherit

Example

min-height: 20pt;

position

Positioning

Sets element positioning. Main values:

1) absolute: absolute positioning

2) fixed: position remains unchanged when scrolling

3) relative: units of measurement

Values

static | relative | absolute | fixed | inherit

Example

position: absolute; top: 50px; right: 20px;

float

Text wrapping around elements

Defines wrapped elements. The value left places the element left and lets text flow on its right; conversely for right. End wrapping with the property clear.

Values

left | right | none | inherit

Example

float: right;

vertical-align

Vertical alignment

Aligns text according to the setting. Permitted values:

1) top: top edge

2) text-top: top of the font (OPS note: readers may treat this value like top )

3) super: superscript

4) middle: centered

5) sub: subscript

6) baseline: text baseline

7) text-bottom: bottom of the font (OPS note: readers may treat this value like bottom )

8) bottom: bottom edge

Values

baseline | sub | super | top | text-top | middle | bottom | text-bottom | <Prozent> | <Länge> | inherit

Example

vertical-align: top;

   

 

 

 

back to top