Borders and Outlines
The frame keys of a style: the border drawn around a box, its corners, the outline drawn outside it, how a table's cells share their borders, and the rule between flowed columns. The padding inside a border and the margin outside it are on Box model; a page's own frame is a page setup key.
The border shorthand
| Key | Takes | What it does |
|---|---|---|
border | "width style colour" | Every side's border at once, as CSS's shorthand: "0.5pt solid #9ca3af". |
borderTop, borderRight, borderBottom, borderLeft | "width style colour" | One side's border. |
The three parts may come in any order and any may be left out: "1pt solid #000", "solid 1 #ccc" and "#b45309 2pt"
are all borders.
| Part | Takes | Left out |
|---|---|---|
| width | a length (1, "1.5pt", "0.5mm"), or thin, medium, thick (1px, 3px and 5px, as CSS has them) | 0.5pt |
| style | one of the border styles | solid |
| colour | a colour as anywhere else: hex, rgb(), a CSS name (see Colour and paint) | black |
"none", or a width of 0, takes the border away. Keys apply in the order written: "border": "1pt solid #9ca3af", "borderTop": "3pt solid #1e3a5f" gives a heavier top, while the same two keys the other way round give four equal
sides. A colour's alpha (#RRGGBBAA) fades that side alone.
The longhands
| Key | Takes | What it does |
|---|---|---|
borderWidth | a length | Width of every side's border. |
borderStyle | a border style | Line style of every side's border. A side with no width yet takes 0.5pt. |
borderColor | a colour | Colour of every side's border. A side with no width yet takes 0.5pt. |
{
"styles": {
"panel": { "border": "1pt solid #9ca3af", "borderTop": "3pt solid #1e3a5f", "padding": 8 },
"dots": { "borderStyle": "dotted", "borderColor": "#7c3aed", "borderWidth": 1.5, "padding": 8, "marginTop": 12 }
},
"content": [
{ "p": "Grey sides and a heavy navy top.", "style": "panel" },
{ "p": "Dotted purple on every side, written key by key.", "style": "dots" }
]
}
Border styles
| Style | Drawn as |
|---|---|
solid | one continuous line |
dashed | dashes three widths long, two widths apart |
dashedFixed | 4pt dashes 2pt apart, whatever the width |
dotted | round dots as wide as the border, two widths apart |
roundDots | round dots at a wider pitch, two and a half widths, fitted to the side's length |
double | two lines, each a third of the width, with the third between them |
groove, ridge | two tones, the line as if carved into the page or raised from it; the top and left lit |
inset, outset | two tones, the box as if pressed into the page or raised from it; the top and left are lit |
none | nothing |
The bands of double and of the four two-tone styles meet at the corners on the diagonal, as CSS Backgrounds 3 joins
them, and a wide side meets a narrow one there too.
Rounded corners
| Key | Takes | Default | What it does |
|---|---|---|---|
borderRadius | a length | Rounds every corner of the box by this radius. | |
borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius | a length | 0 | Rounds one corner. |
A radius rounds the background too, with or without a border (CSS Backgrounds 3 4.3), so a filled box with a radius
of half its size is a disc. An inline [span, style]...[/span] run takes the border and the radius too:
{
"styles": {
"disc": { "color": "#ffffff", "fontWeight": "bold", "backgroundColor": "#3b4a2f", "padding": "2 6", "borderRadius": 8 },
"leaf": { "backgroundColor": "#ecfdf5", "border": "1pt solid #047857", "borderTopLeftRadius": 14,
"borderBottomRightRadius": 14, "padding": 10, "marginTop": 12 }
},
"content": [
{ "p": "Step [span, disc]3[/span] of 5" },
{ "p": "A leaf corner: two corners rounded, two square.", "style": "leaf" }
]
}
For a shape other than a rounded rectangle - a diamond, a circle - clip the box with
clipPath. A table whose borders collapse keeps square corners, and so does every cell in it (CSS Backgrounds 3 4.6); the report
says so, and borderCollapse: separate on the table rounds them.
Outlines
| Key | Takes | Default | What it does |
|---|---|---|---|
outline | "width style colour" | A frame drawn outside the border box, as CSS UI 4 has it. It takes no space: nothing moves for it. | |
outlineOffset | a length, negative allowed | 0 | The space between the border box and the outline. Negative draws the outline inside the box, over its own background. |
An outline goes round a paragraph, a heading, a table or a list alike; a table's caption stands outside it.
{
"styles": {
"framed": { "border": "2pt solid #1e3a5f", "outline": "1pt dashed #b45309", "outlineOffset": 3, "padding": 8 },
"flagged": { "outline": "1pt dotted #15803d", "outlineOffset": -3, "backgroundColor": "#f0fdf4", "padding": 8, "marginTop": 12 }
},
"content": [
{ "p": "A navy border with a dashed orange outline 3 points outside it.", "style": "framed" },
{ "p": "A dotted green outline 3 points inside the box.", "style": "flagged" }
]
}
Table borders
| Key | Takes | Default | What it does |
|---|---|---|---|
borderCollapse | collapse, separate | collapse | Whether neighbouring cells share one border (collapse) or each draws its own, set apart by borderSpacing (separate). |
borderSpacing | a length, or [across, down] | Space between the cells of a separated table: one length for both directions, or two. |
A table collapses unless told otherwise, where CSS's initial value is separate; its cells draw a 0.5pt black grid
until a style says otherwise. Collapsed, a table's own border is weighed against the border of each cell on its edge
and the wider one is drawn there; where the table's is no wider, the cell keeps its own and a notice says the table's
was not drawn (CSS Tables 3 3.7.1). Two cells meeting along a line draw it once, in the more specific of their two
borders - the wider, then double, solid, dashed, dotted, ridge, outset, groove, inset, and of two alike
the one further up, then further left (further right in a right-to-left table). A side set to none is the least
specific, so a cell with no border leaves its neighbours' lines standing. The line is drawn centred on the grid line, so a translucent border is as light inside the
table as on its edge and a dashed line keeps one pattern across a span. Where lines cross, the most specific one runs
through. A collapsed inset is drawn as ridge and outset as groove (CSS 2.1 17.6.3). Separated, each cell is a box of its own, borderSpacing
apart, and the table draws its own border, corners and background around them (CSS 2.1 17.6.1); a cell that spans
columns or rows spans the spacing between them too.
{
"styles": {
"apart": { "borderCollapse": "separate", "borderSpacing": [6, 12], "border": "1.5pt solid #b91c1c",
"borderRadius": 8, "backgroundColor": "#fef3c7", "padding": 4 }
},
"content": [
{ "table": { "style": "apart", "rows": [
[ { "th": "Key" }, { "th": "Value" } ],
[ { "td": "borderSpacing" }, { "td": "6 across, 12 down" } ]
] } }
]
}
The rest of a table's keys are on Tables.
A rule between columns
| Key | Takes | What it does |
|---|---|---|
columnRule | "width style colour" | A rule in the middle of each gap between flowed columns, as CSS's column-rule: "0.5pt solid #9ca3af". It takes no space. |
A rule is drawn only between two columns that both hold content. Its styles are read as in the collapsing border model,
where inset is drawn as ridge and outset as groove. It is read on a paragraph, a heading and a list flowed
through columns, and on a columns node.
{
"styles": {
"twoUp": { "columnCount": 2, "columnGap": 24, "columnRule": "0.5pt solid #9ca3af" }
},
"content": [
{ "p": "A report set in two columns, the gap between them ruled down its middle. The rule takes no room of its own, so the columns are as wide as they would be without it, and the text on either side keeps its full measure.", "style": "twoUp" }
]
}
Where a key cannot act
The render report names a key that does nothing where it stands, once per style and kind:
| Key | Does nothing on | Why |
|---|---|---|
| every border, radius and outline key | svg shapes and svg text | a shape's outline is its stroke; see Colour and paint |
borderCollapse | anything but a table | it is a table's own key (CSS Tables 3 3.7) |
columnRule | a cell, a table, an image, a rule, an svg, a table of contents, a header or footer, a watermark | none of them is text flowed through columns |
In a DOCX
| Key | In the DOCX |
|---|---|
borderRadius and the corner keys | Not drawn: the box is square, and the report says so. |
outline, outlineOffset | Not drawn: a paragraph carries one frame in WordprocessingML, and the report says so. |
columnRule | A plain line between the section's columns; a styled rule (dashed, dotted, a colour) is reported as not carried. |
borderCollapse: separate | Written as Word's cell spacing, which Word halves between cells: the table comes out about 2 points taller. A separated table's own border is not carried, and is reported; its background is. |
| A colour's alpha | Written as it looks over the background; see Colour and paint. |