/

Container

The .container docs ↗ function creates a highly customizable block of content, and resets the current layout rules back to normal.

Layout reset

Example 1

Imagine you want to create a row with two columns, each containing a heading and some text. A beginner might try the following wrong approach. As explained in the Stacks page, stack functions rely on the strict Markdown concept of a block, an isolated chunk of the document, to determine which elements they handle.

<!-- WRONG! -->
.row alignment:{center} gap:{1cm}
    ##! Left
    Text on left column.

    ##! Right
    Text on right column.

Left

Text on left column.

Text on right column.

Example 2

You might then try using columns. This works, but the concept is not quite right. You do not want a layout rule; you just want to reset the document flow back to normal. This is exactly what the container does: it groups elements together according to the natural flow of the document.

<!-- Could be improved -->
.row alignment:{center} gap:{1cm}
    .column cross:{start}
        ##! Left
        Text on left column.

    .column cross:{start}
        ##! Right
        Text on right column.

Left

Text on left column.

Text on right column.

Example 3

The correct way to achieve the desired layout is to use containers. Each container resets the layout rules, allowing the row to treat them as separate blocks of content.

<!-- Correct! -->
.row alignment:{center} gap:{1cm}
    .container
        ##! Left
        Text on left column.

    .container
        ##! Right
        Text on right column.

Left

Text on left column.

Text on right column.

Styling

The following optional parameters are available:

ParameterDescriptionAcceptsDefault
widthBox width constraint.SizeNo constraint
heightBox height constraint.SizeNo constraint
fullwidthWhether to take up the parent’s full width. Overridden by width.BooleanFalse
foregroundText color.ColorDocument’s default
backgroundBackground color.ColorNone
borderBorder color.ColorBrowser’s default if borderwidth is set, none otherwise
borderwidthBorder size.SizesBrowser’s default if border is set, none otherwise
borderstyleBorder type.normal, dashed, dotted, doublenormal if border or borderwidth is set, none otherwise
margin Whitespace outside the content.SizesNone
padding Whitespace around the content.SizesNone
radiusCorner or border radius.SizesNone
alignmentContent alignment.start, center, endBrowser’s default
textalignmentText alignment.start, center, end, justifyBrowser’s default
fontsize, fontweight, fontstyle, fontvariant, textdecoration, textcaseText transformation. See Advanced text formatting for details.None
classnameCustom CSS class name.StringNone

Example 4

.container fullwidth:{yes} borderstyle:{dashed} padding:{1cm} fontsize:{medium} fontstyle:{italic} fontvariant:{smallcaps}
    This is a styled container. Fancy, isn't it?

    Quarkdown can truly give life to complex layouts with ease.

This is a styled container. Fancy, isn’t it?

Quarkdown can truly give life to complex layouts with ease.