Skip to content

Rect

The <rect> can be used to display a rectangle in a certain color.

It can be used both within <body> and <template>.

Examples

<template ...>
  <rect
    bottom="247mm"
    left="0"
    width="210mm"
    height="50mm"
    color="rgb(255, 10, 10)"
  />
</template>
<body ...>
  ...
  <rect
    width="100%"
    height="2cm"
    border="2"
    borderColor="red"
    spaceBefore="10"
    spaceAfter="20"
  />
</template>

Attributes

width

The width of the rectangle. Can be in pt, mm, cm, or % (e.g. width="100%" when used in <body>).

height

The height of the rectangle. Can be in pt, mm, or cm.

left

Only used in <template> context. The distance from the left border of the document, in pt, mm, or cm.

bottom

Only used in <template> context. The distance from the bottom border of the document, in pt, mm, or cm.

color (optional)

The fill color of the rectangle. Can be a named color (e.g. red) or an RGB value (e.g. rgb(255, 10, 10)).

border (optional)

The width of the border in pt.

borderColor (optional)

The color of the border. Required together with border for the border to be drawn.

class (optional)

The style class to apply to the rectangle.

spaceBefore (optional)

Space before the rectangle in pt, mm or cm. Only applies in <body> context.

spaceAfter (optional)

Space after the rectangle in pt, mm or cm. Only applies in <body> context.