Previous Page

Next Page

Flying Saucer XML/CSS2 Renderer

CSS Margin, Paddings and Backgrounds

Margin, padding and background support includes: CSS margin and padding, on any or all four sides of a box. You can apply both shorthand "padding: 1px") or to individual sides ("margin-left: 10em"). Backgrounds can be colored and/or include images (as background attachments). Background images can be repeated horizontally, vertically, or both, and fixed in place.

Fixed, no-repeat background image

### Margins

margins = 0
margins = 20px
margins = 10,20,30,40

### Padding

padding = 0
padding = 20px
padding = 10,20,30,40

### Backgrounds

div with colored background and margin = 20 padding = 20 border = 20
div with image back and no repeat
div with image back and repeat both
div with fixed image background and repeat both