Layout Values

Common Visual Property Units

This article describes common values that you can use in layout properties.

Boolean Values

You can represent the true and false values with multiple keywords:

ValueDescription
trueUse a particular style feature. Accepted keywords: true, yes, or on.
falseDo not use a particular style feature. Accepted keywords: false, no, or off.

Border Values

When you specify the border of a component, you can use these three border properties:

  • Border width. The stroke width to draw the border.
  • Border style. The border style pattern to apply.
  • Border color. The color of the border. You must specify at least one of these properties to display a border. You can specify the border properties in any order; however, you can specify a property only once. All of these border specifications are correct:
1px solid blue
3px
dashed 4px #f0cccc
#f0cccc 4 dashed
#f0f dotted

Border Rounding

You can define border rounding values to round the corners of a component's outer border edge. You can set a single radius to make circular corners or two radii to make elliptical ones. Radius values use the size value syntax and semantics.

When you specify multiple radii, the first value determines the horizontal rounding, and the second the vertical rounding.

Border Style Values

The engine supports these border style values:

ValueDescription
dashedDisplays a series of short square-ended dashes or line segments.
dottedDisplays a series of rounded dots.
doubleDisplays two straight lines that add up to the pixel size defined by the border width.
grooveDisplays a border with a carved appearance. It is the opposite of ridge.
insetDisplays a border that makes the element appear embedded. It is the opposite of outset.
ousetDisplays a border that makes the element appear embossed. It is the opposite of inset.
ridgeDisplays a border with an extruded appearance. It is the opposite of groove.
solidDisplays a single, straight, solid line.

Color Values

The engine accepts several color value types:

  • Hexadecimal RGB/RGBA color definitions. You can specify color values with RGB or ARGB codes using a # prefix and 3, 4, 6, or 8 hexadecimal digits.
  • The rgb function. Use the rgb function with three arguments representing the red, green, and blue components. Each component can be specified as a value between 0 and 255 or as a percentage value between 0% and 100%. You must use the same value type for all colors (numeric value or percentage); they cannot be mixed.
  • The rgba function. Use the rgba function with four arguments. The first three arguments represent the color channels (see the rgb function). The alpha channel can have a percentage value (0% - 100%) or a float number between 0 and 1.
  • The hsl function. Describe a color with the hsl function with three arguments representing the Hue angle (units are deg, rad, grad, or turn), the Saturation percentage (0% - 100%), and the Lightness percentage(0% - 100%).
  • The hsla function. Describe a color with the hsla function with three arguments representing the H, S, and L values (see hsl) and the alpha channel (a percentage value (0% - 100%) or a float number between 0 and 1).
  • Named colors. You can use standard CSS color names (all lowercase letters). See the MDN documentation for more details.

Cursor Values

This type of value sets the mouse cursor, if any, to show when the mouse pointer is over a particular component.

General

ValueDescription
autoThe engine will determine the cursor to display based on the current context.
defaultThe platform-dependent default cursor. Typically, an arrow.
noneNo cursor is rendered.

Links and Status

ValueDescription
context‑menuA context menu is available.
helpHelp information is available.
pointerThe cursor is a pointer that indicates a link. Typically, it is an image of a pointing hand.
progressThe program is busy in the background, but the user can still interact with the interface (in contrast to wait).
waitThe program is busy, and the user can't interact with the interface (in contrast to progress). Sometimes an image of an hourglass or a watch.

Selection

ValueDescription
cellThe table cell or set of cells can be selected.
crosshairCross cursor, often used to indicate selection in a bitmap.
textThe text can be selected. Typically, the shape of an I-beam.
vertical‑textThe vertical text can be selected. Typically, the shape of a sideways I-beam.

Drag and Drop

ValueDescription
aliasAn alias or shortcut is to be created.
copySomething is to be copied.
moveSomething is to be moved.
no‑dropAn item may not be dropped at the current location. Firefox bug 275173: On Windows and macOS, no-drop is the same as not-allowed.
not‑allowedThe requested action will not be carried out.
grabSomething can be grabbed (dragged to be moved).
grabbingSomething is being grabbed (dragged to be moved).

Resizing and Scrolling

ValueDescription
all‑scrollSomething can be scrolled in any direction (panned). Firefox bug 275174: On Windows, all-scroll is the same as move.
col‑resizeThe item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating them.
row‑resizeThe item/row can be resized vertically. Often rendered as arrows pointing up and down with a horizontal bar separating them.
n‑resize, e‑resize, s‑resize, w‑resize, ne‑resize, nw‑resize, se‑resize, sw‑resize, ew‑resize, ns‑resize, nesw‑resize, nwse‑resizeSome edge is to be moved. For example, the se‑resize cursor is used when the movement starts from the south-east corner of the box. In some environments, an equivalent bidirectional resize cursor is shown. For example, n‑resize and s‑resize are the same as ns‑resize.

Zooming

ValueDescription
zoom‑in, zoom‑outSomething can be zoomed (magnified) in or out.

Cursor Examples

Move the mouse over the rectangles in the following example to check what the cursor looks like.

Font Family Values

Font family values are a prioritized list of one or more font family names and/or generic family names. Multiple names should be separated by commas. Font family names containing whitespace should be quoted. These are the generic family names:

NameDescription
serifGlyphs have finishing strokes, flared or tapering ends, or have actual serifed endings.
sans‑serifGlyphs have stroke endings that are plain.
monospaceAll glyphs have the same fixed width.
cursiveGlyphs in cursive fonts generally have either joining strokes or other cursive characteristics beyond those of italic typefaces. The glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letter work.
fantasyfantasy fonts are primarily decorative fonts that contain playful representations of characters.
system‑uiGlyphs are taken from the default user interface font on a given platform. Because typographic traditions vary widely across the world, this generic is provided for typefaces that don't map cleanly into the other generics.
ui‑serifThe default user interface serif font.
ui‑sans‑serifThe default user interface sans-serif font.
ui‑monospaceThe default user interface monospace font.
ui‑roundedThe default user interface font that has rounded features.
mathThis is for the particular stylistic concerns of representing mathematics: superscript and subscript, brackets that cross several lines, nesting expressions, and double struck glyphs with distinct meanings.
emojiFonts that are specifically designed to render emoji.
fangsongA particular style of Chinese characters that are between serif-style Song and cursive-style Kai forms. This style is often used for government documents.
📔

A generic font family should be the last item in the list of font family names.

Examples:

Helvetica
"Times New Roman"
Bookville, "Times New Roman", serif

Font Weight Values

Font weight values set the font's weight (or boldness); the available values depend on the currently selected font family.

Weight values can be numbers between 1 and 1000. The hundreds (100, 200, 300, ..., 900) are conventionally used. You can use a few identifiers to specify the font weights:

ValueDescription
normalNormal font weight. Same as 400.
boldBold font weight. Same as 700.
lighterOne relative font weight lighter than the parent element.
bolderOne relative font weight heavier than the parent element.

Font Style Values

This property determines whether a font should be styled with a normal, italic, or oblique face from its font family.

ValueDescription
normalSelects a font that is classified as normal within a font family.
italicSelects a font that is classified as italic. If no italic version of the face is available, one classified as oblique is used instead. If neither is available, the style is artificially simulated.
obliqueSelects a font that is classified as oblique. If no oblique version of the face is available, one classified as italic is used instead. If neither is available, the style is artificially simulated.

Font Stretch Values

This property selects a regular, condensed, or expanded face from a font. Its value can be specified as a percentage value or as one of the following:

ValueDescription
normalSpecifies a normal font face.
semi‑condensed, condensed, extra‑condensed, ultra‑condensedSpecifies a more condensed font face than normal, with ultra‑condensed as the most condensed.
semi‑expanded, expanded, extra‑expanded, ultra‑expandedSpecifies a more expanded font face than normal, with ultra‑expanded as the most expanded.

Opacity

This property sets an element's opacity. Opacity is the degree to which the content behind an element is hidden, and it is the opposite of transparency.

The property value is a number in the range of 0.0 to 1.0, inclusive, or a percentage in the range of 0% to 100%, inclusive, representing the opacity of the channel (that is, the value of its alpha channel). Any value outside the interval, though valid, is clamped to the nearest limit in the range.

Overflow Values

A component may not fit into the viewport its parent provides. An overflow value specifies the engine's strategy in such a case.

ValueDescription
visible(default) Overflow content is not clipped and may be visible outside the element's padding box.
hiddenOverflow content is clipped at the element's padding box. There are no scroll bars, and the clipped content is not visible (i.e., clipped content is hidden), but the content still exists.
scrollOverflow content is clipped at the element's padding box, and overflow content can be scrolled into view using scroll bars.

Outline Values

When you specify the outline of a component, you can use these three properties:

  • Outline width. The stroke width to draw the outline.
  • Outline style. The outline style pattern to apply.
  • Outline color. The color of the outline.

You must specify all of these properties to display an outline. You can specify the outline properties in any order; however, you can specify a property only once. All of these outline specifications are correct:

1px solid blue
dashed 4px #f0cccc
#f0cccc 4 dashed

Shadow Values

You can define shadow values with one or more shadow effects. If you use more than one effect, you must separate them with a comma. A shadow effect is composed of these parts:

  • Horizontal offset of the effect
  • Vertical offset of the effect
  • Blur radius
  • Spread radius
  • Optional color

The first up to four size value segments are followed by the optional color value.

You can use two, three, or four size values.

  • If only two values are given, the engine interprets them as the horizontal and vertical offsets.
  • If a third value is given, it is interpreted as a blur radius.
  • If a fourth value is given, it is interpreted as a spread radius.

When you prefix the shadow value with inset, it changes the shadow from an outer box shadow to an inner box shadow (as if the content is pressed into the box).

Size Values

Size values are composed of a numeric value and an optional unit. Here are a few examples:

12px
0.25rem
50%
0
125mm

UI Engine uses these units with the CSS semantics:

UnitDescription
cmCentimeters (1cm = 37.8px = 25.2/64in)
mmMillimeters (1mm = 1/10th of 1cm)
inInches (1in = 2.54cm = 96px)
pcPicas (1pc = 1/6th of 1in)
ptPoints (1pt = 1/72nd of 1in)
pxPixels (1px = 1/96th of 1in)
emRelative to the font size of the parent component, in the case of typographical properties (like the font size), and font size of the element itself, in the case of other properties like (width).
exx-height (the height of a normal lowercase "x") of the element's font.
chThe advance measure (width) of the glyph "0" of the element's font.
chThe advance measure (width) of the glyph "0" of the element's font.
remFont size of the root element.
vw1% of the viewport's width.
vh1% of the viewport's height.
vmin1% of the viewport's smaller dimension.
vmax1% of the viewport's smaller dimension.
%The percentage value is relative to the parent container's viewport size offered for the particular child element.
*Start sizing: The size weight used when calculating the dimension of the particular child element. The base of the calculation is the remaining space size in the parent's viewport.

Text Alignment Values

This value sets the horizontal alignment of the inline-rendered content (e.g., text) inside its block-rendered parent.

ValueDescription
startThe same as left if direction is left-to-right and right if direction is right-to-left.
endThe same as right if direction is left-to-right and left if direction is right-to-left.
leftThe inline contents are aligned to the left edge of the line box.
rightThe inline contents are aligned to the right edge of the line box.
centerThe inline contents are centered within the line box.
justifyThe inline contents are justified. Text should be spaced to line up its left and right edges to the left and right edges of the line box, except for the last line.

Text Decoration Values

A text decoration value is composed of these segments:

  • color. The color of the decoration
  • line. The kind of decoration used
  • style. The line style to use

You can use one, two, or three segments when specifying the text decoration. They can be in any order; however, one segment type can be used only once.

These are the available line values:

ValueDescription
underlineEach line of text has a decorative line beneath it.
overlineEach line of text has a decorative line above it.
line-throughEach line of text has a decorative line going through its middle.

You can use these style values:

ValueDescription
solidDraws a single line.
doubleDraws a double line.
dottedDraws a dotted line.
dashedDraws a dashed line.
wavyDraws a wavy line.

Text Transform Values

This value specifies how to capitalize a component's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.

ValueDescription
noneConverts the first letter of each word to uppercase. Other characters remain unchanged (they retain their original case as written in the element's text)
capitalizeDraws a double line.
uppercaseConverts all characters to uppercase.
lowercaseConverts all characters to lowercase.
full-widthForces the writing of a character — mainly ideograms and Latin scripts — inside a square, allowing them to be aligned in the usual East Asian scripts (like Chinese or Japanese).
full-size-kanaGenerally used for ruby annotation text, the keyword converts all small Kana characters to the equivalent full-size Kana, to compensate for legibility issues at the small font sizes typically used in ruby.

Text Wrap Values

This value controls how text inside an element is wrapped.

ValueDescription
wrapText is wrapped across lines at appropriate characters (for example, spaces in languages like English that use space separators) to minimize overflow. (default)
nowrapThe text does not wrap across lines. It will overflow its containing element rather than breaking onto a new line.
balanceThe text is wrapped in a way that best balances the number of characters on each line, enhancing layout quality and legibility.
prettyResults in the same behavior as wrap, except that the user agent will use a slower algorithm that favors better layout over speed.
stableResults in the same behavior as wrap, except that when the user is editing the content, the lines that come before the lines they are editing remain static rather than the whole block of text re-wrapping.

User Select Values

These values control whether the user can select text.

ValueDescription
noneThe text of the component and its children is not selectable.
autoAutomatically determines the value.
textThe text can be selected by the user.
allThe content of the component shall be selected atomically: If a selection would contain part of the component, then the selection must contain the entire component, including all its children. If a double-click or context-click occurs in sub-components, the highest ancestor with this value will be selected.
containsEnables selection to start within the component; however, the selection will be contained by the bounds of that component.

Zoom Values

The value of the zoom property controls the magnification level of a component:

ValueDescription
normalRender the element at its normal size; equal to 1.
resetThis resets the value to zoom: 1 and prevents the element from being (de)magnified if the user applies non-pinch-based zooming (e.g., by pressing Ctrl—or Ctrl+ keyboard shortcuts) to the document.
percentage value100% is equivalent to normal. Values larger than 100% zoom in. Values smaller than 100% zoom out.
numberEquivalent to the corresponding percentage (1.0 = 100% = normal). Values larger than 1.0 zoom in. Values smaller than 1.0 zoom out.