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:
Value | Description |
---|---|
true | Use a particular style feature. Accepted keywords: true , yes , or on . |
false | Do 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:
Value | Description |
---|---|
dashed | Displays a series of short square-ended dashes or line segments. |
dotted | Displays a series of rounded dots. |
double | Displays two straight lines that add up to the pixel size defined by the border width. |
groove | Displays a border with a carved appearance. It is the opposite of ridge . |
inset | Displays a border that makes the element appear embedded. It is the opposite of outset . |
ouset | Displays a border that makes the element appear embossed. It is the opposite of inset . |
ridge | Displays a border with an extruded appearance. It is the opposite of groove . |
solid | Displays 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 thergb
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 thergba
function with four arguments. The first three arguments represent the color channels (see thergb
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 thehsl
function with three arguments representing the Hue angle (units aredeg
,rad
,grad
, orturn
), the Saturation percentage (0% - 100%), and the Lightness percentage(0% - 100%). - The
hsla
function. Describe a color with thehsla
function with three arguments representing the H, S, and L values (seehsl
) 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
Value | Description |
---|---|
auto | The engine will determine the cursor to display based on the current context. |
default | The platform-dependent default cursor. Typically, an arrow. |
none | No cursor is rendered. |
Links and Status
Value | Description |
---|---|
context‑menu | A context menu is available. |
help | Help information is available. |
pointer | The cursor is a pointer that indicates a link. Typically, it is an image of a pointing hand. |
progress | The program is busy in the background, but the user can still interact with the interface (in contrast to wait ). |
wait | The 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
Value | Description |
---|---|
cell | The table cell or set of cells can be selected. |
crosshair | Cross cursor, often used to indicate selection in a bitmap. |
text | The text can be selected. Typically, the shape of an I-beam. |
vertical‑text | The vertical text can be selected. Typically, the shape of a sideways I-beam. |
Drag and Drop
Value | Description |
---|---|
alias | An alias or shortcut is to be created. |
copy | Something is to be copied. |
move | Something is to be moved. |
no‑drop | An 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‑allowed | The requested action will not be carried out. |
grab | Something can be grabbed (dragged to be moved). |
grabbing | Something is being grabbed (dragged to be moved). |
Resizing and Scrolling
Value | Description |
---|---|
all‑scroll | Something can be scrolled in any direction (panned). Firefox bug 275174: On Windows, all-scroll is the same as move. |
col‑resize | The item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating them. |
row‑resize | The 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‑resize | Some 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
Value | Description |
---|---|
zoom‑in , zoom‑out | Something 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:
Name | Description |
---|---|
serif | Glyphs have finishing strokes, flared or tapering ends, or have actual serifed endings. |
sans‑serif | Glyphs have stroke endings that are plain. |
monospace | All glyphs have the same fixed width. |
cursive | Glyphs 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. |
fantasy | fantasy fonts are primarily decorative fonts that contain playful representations of characters. |
system‑ui | Glyphs 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‑serif | The default user interface serif font. |
ui‑sans‑serif | The default user interface sans-serif font. |
ui‑monospace | The default user interface monospace font. |
ui‑rounded | The default user interface font that has rounded features. |
math | This 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. |
emoji | Fonts that are specifically designed to render emoji. |
fangsong | A 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:
Value | Description |
---|---|
normal | Normal font weight. Same as 400 . |
bold | Bold font weight. Same as 700 . |
lighter | One relative font weight lighter than the parent element. |
bolder | One 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.
Value | Description |
---|---|
normal | Selects a font that is classified as normal within a font family. |
italic | Selects 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. |
oblique | Selects 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:
Value | Description |
---|---|
normal | Specifies a normal font face. |
semi‑condensed , condensed , extra‑condensed , ultra‑condensed | Specifies a more condensed font face than normal, with ultra‑condensed as the most condensed. |
semi‑expanded , expanded , extra‑expanded , ultra‑expanded | Specifies 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.
Value | Description |
---|---|
visible | (default) Overflow content is not clipped and may be visible outside the element's padding box. |
hidden | Overflow 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. |
scroll | Overflow 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:
Unit | Description |
---|---|
cm | Centimeters (1cm = 37.8px = 25.2/64in) |
mm | Millimeters (1mm = 1/10th of 1cm) |
in | Inches (1in = 2.54cm = 96px) |
pc | Picas (1pc = 1/6th of 1in) |
pt | Points (1pt = 1/72nd of 1in) |
px | Pixels (1px = 1/96th of 1in) |
em | Relative 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). |
ex | x-height (the height of a normal lowercase "x") of the element's font. |
ch | The advance measure (width) of the glyph "0" of the element's font. |
ch | The advance measure (width) of the glyph "0" of the element's font. |
rem | Font size of the root element. |
vw | 1% of the viewport's width. |
vh | 1% of the viewport's height. |
vmin | 1% of the viewport's smaller dimension. |
vmax | 1% 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.
Value | Description |
---|---|
start | The same as left if direction is left-to-right and right if direction is right-to-left. |
end | The same as right if direction is left-to-right and left if direction is right-to-left. |
left | The inline contents are aligned to the left edge of the line box. |
right | The inline contents are aligned to the right edge of the line box. |
center | The inline contents are centered within the line box. |
justify | The 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:
Value | Description |
---|---|
underline | Each line of text has a decorative line beneath it. |
overline | Each line of text has a decorative line above it. |
line-through | Each line of text has a decorative line going through its middle. |
You can use these style values:
Value | Description |
---|---|
solid | Draws a single line. |
double | Draws a double line. |
dotted | Draws a dotted line. |
dashed | Draws a dashed line. |
wavy | Draws 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.
Value | Description |
---|---|
none | Converts the first letter of each word to uppercase. Other characters remain unchanged (they retain their original case as written in the element's text) |
capitalize | Draws a double line. |
uppercase | Converts all characters to uppercase. |
lowercase | Converts all characters to lowercase. |
full-width | Forces 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-kana | Generally 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.
Value | Description |
---|---|
wrap | Text is wrapped across lines at appropriate characters (for example, spaces in languages like English that use space separators) to minimize overflow. (default) |
nowrap | The text does not wrap across lines. It will overflow its containing element rather than breaking onto a new line. |
balance | The text is wrapped in a way that best balances the number of characters on each line, enhancing layout quality and legibility. |
pretty | Results in the same behavior as wrap , except that the user agent will use a slower algorithm that favors better layout over speed. |
stable | Results 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.
Value | Description |
---|---|
none | The text of the component and its children is not selectable. |
auto | Automatically determines the value. |
text | The text can be selected by the user. |
all | The 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. |
contains | Enables 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:
Value | Description |
---|---|
normal | Render the element at its normal size; equal to 1 . |
reset | This 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 value | 100% is equivalent to normal. Values larger than 100% zoom in. Values smaller than 100% zoom out. |
number | Equivalent to the corresponding percentage (1.0 = 100% = normal ). Values larger than 1.0 zoom in. Values smaller than 1.0 zoom out. |