monks/white_space

The white-space CSS property sets how {{Glossary(“whitespace”, “white space”)}} inside an element is handled.

Values

pub const auto_: #(String, String)

auto value of white-space

pub const balance: #(String, String)

balance value of white-space

pub const break_spaces: #(String, String)

break-spaces value of white-space

pub const collapse: #(String, String)

collapse value of white-space

pub const discard: #(String, String)

discard value of white-space

pub const discard_after: #(String, String)

discard-after value of white-space

pub const discard_before: #(String, String)

discard-before value of white-space

pub const discard_inner: #(String, String)

discard-inner value of white-space

pub const inherit: #(String, String)
pub const initial: #(String, String)
pub const none: #(String, String)

none value of white-space

pub const normal: #(String, String)
  • : Sequences of white space are collapsed. Newline characters in the source are handled the same as other white spaces. Lines are broken as necessary to fill line boxes. Equivalent to collapse wrap.
pub const nowrap: #(String, String)

nowrap value of white-space

pub const pre: #(String, String)
  • : Sequences of white space are preserved. Lines are only broken at newline characters in the source and at {{HTMLElement(“br”)}} elements. Equivalent to preserve nowrap.
pub const pre_line: #(String, String)
  • : Sequences of white space are collapsed. Lines are broken at newline characters, at {{HTMLElement(“br”)}}, and as necessary to fill line boxes. Equivalent to preserve-breaks wrap.> [!NOTE]> The white-space property as a shorthand is a relatively new feature (see browser compatibility). Originally, it had six keyword values; now, the value nowrap is instead interpreted as a value for {{cssxref(“text-wrap-mode”)}}, while the value break-spaces is interpreted as a value for {{cssxref(“white-space-collapse”)}}. The above four keywords are still specific to white-space, but they have longhand equivalents. The change to make white-space a shorthand expands acceptable values to even more keywords and combinations, such as wrap and collapse.The following table summarizes the behavior of these four white-space keyword values:
    New lines Spaces and tabs Text wrapping End-of-line spaces End-of-line other space separators
    normal Collapse Collapse Wrap Remove Hang
    pre Preserve Preserve No wrap Preserve No wrap
    pre-wrap Preserve Preserve Wrap Hang Hang
    pre-line Preserve Collapse Wrap Remove Hang
    A tab defaults to 8 spaces and can be configured using the tab-size property. In the case of normal, nowrap, and pre-line values, every tab is converted to a space (U+0020) character.> [!NOTE]> There is a distinction made between spaces and other space separators. These are defined as follows:>> - spaces> - : Spaces (U+0020), tabs (U+0009), and segment breaks (such as newlines).> - other space separators> - : All other space separators defined in Unicode, other than those already defined as spaces.>> Where white space is said to hang, this can affect the size of the box when measured for intrinsic sizing.
pub const pre_wrap: #(String, String)
  • : Sequences of white space are preserved. Lines are broken at newline characters, at {{HTMLElement(“br”)}}, and as necessary to fill line boxes. Equivalent to preserve wrap.
pub const preserve: #(String, String)

preserve value of white-space

pub const preserve_breaks: #(String, String)

preserve-breaks value of white-space

pub const preserve_spaces: #(String, String)

preserve-spaces value of white-space

pub const pretty: #(String, String)

pretty value of white-space

pub fn raw(value: String) -> #(String, String)

Enter a raw string value for white-space

pub const revert: #(String, String)
pub const revert_layer: #(String, String)
pub const stable: #(String, String)

stable value of white-space

pub const unset: #(String, String)
pub fn var(variable: String) -> #(String, String)

Enter a variable name to be used for white-space. It will be wrapped in var() and have -- prepended.

pub const wrap: #(String, String)

wrap value of white-space

Search Document