Skip to main content

Css

Struct Css 

Source
pub struct Css { /* private fields */ }
Expand description

A type-safe CSS style declaration block.

Build a style by chaining builder methods; every method returns Self so further calls can be appended fluently. The resulting CSS text is produced by ToCss::to_css_string or via Display.

use whisker_css::ext::*;
use whisker_css::{Color, Display, FlexDirection, Css};

let s = Css::new()
    .display(Display::Flex)
    .flex_direction(FlexDirection::Column)
    .padding(px(12))
    .background_color(Color::hex(0x1A1A2E));

Implementations§

Source§

impl Css

Source

pub fn new() -> Self

An empty style.

Source

pub fn raw(self, name: &'static str, value: impl Into<String>) -> Self

Escape hatch — append a raw CSS declaration without type-checking. Use this when Lynx supports a property Whisker has not yet wrapped, or when copying a value verbatim from hand-written CSS.

name should be a &'static str because property names are part of the CSS grammar, not runtime data. The value is taken verbatim and not validated.

Source

pub fn is_empty(&self) -> bool

True if no declarations have been added.

Source

pub fn len(&self) -> usize

Number of declarations currently in the style. Repeats of the same property are counted separately; they collapse during serialization.

Source

pub fn entries(&self) -> impl Iterator<Item = &CssProp>

Iterate over every entry in insertion order, including duplicates of the same property. Use Self::resolved for last-write-wins iteration.

Source

pub fn resolved(&self) -> Vec<&CssProp>

Iterate over entries with the last-write-wins rule applied: only the final occurrence of each property name is yielded, in the position of that final occurrence.

Source

pub fn merge(self, other: Css) -> Self

Extend by appending every entry of other. Later writes win during serialization, so .merge(other) lets other override declarations already set on self.

Source§

impl Css

Source§

impl Css

Source

pub fn background_color(self, v: Color) -> Self

Sets background-color. Lynx default: transparent. https://lynxjs.org/api/css/properties/background-color

Source

pub fn background_image(self, v: impl Into<ImageRef>) -> Self

Sets background-image. Accepts url(...) and <gradient>. none clears any existing image. https://lynxjs.org/api/css/properties/background-image

Source

pub fn background_repeat(self, v: BackgroundRepeat) -> Self

Source

pub fn background_position(self, v: Position) -> Self

Source

pub fn background_position_x(self, v: impl Into<LengthPercentage>) -> Self

Sets background-position-x — horizontal component only. https://lynxjs.org/api/css/properties/background-position-x

Source

pub fn background_position_y(self, v: impl Into<LengthPercentage>) -> Self

Sets background-position-y — vertical component only. https://lynxjs.org/api/css/properties/background-position-y

Source

pub fn background_size(self, v: BackgroundSize) -> Self

Source

pub fn background_origin(self, v: BackgroundOrigin) -> Self

Sets background-origin. Lynx default: padding-box. https://lynxjs.org/api/css/properties/background-origin

Source

pub fn background_clip(self, v: BackgroundClip) -> Self

Sets background-clip. Lynx default: border-box. https://lynxjs.org/api/css/properties/background-clip

Source

pub fn background_attachment(self, v: BackgroundAttachment) -> Self

Sets background-attachment. Lynx default: scroll. https://lynxjs.org/api/css/properties/background-attachment

Source

pub fn color(self, v: Color) -> Self

Sets color — the foreground color used by text and SVG strokes. https://lynxjs.org/api/css/properties/color

Source§

impl Css

Source

pub fn border_top_width(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_right_width(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_bottom_width(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_left_width(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_top_style(self, v: BorderStyle) -> Self

Source

pub fn border_right_style(self, v: BorderStyle) -> Self

Source

pub fn border_bottom_style(self, v: BorderStyle) -> Self

Source

pub fn border_left_style(self, v: BorderStyle) -> Self

Source

pub fn border_top_color(self, v: Color) -> Self

Source

pub fn border_right_color(self, v: Color) -> Self

Source

pub fn border_bottom_color(self, v: Color) -> Self

Source

pub fn border_left_color(self, v: Color) -> Self

Source

pub fn border_top_left_radius(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_top_right_radius(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_bottom_right_radius(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_bottom_left_radius(self, v: impl Into<LengthPercentage>) -> Self

Source

pub fn border_radius(self, v: impl Into<LengthPercentage>) -> Self

Sets border-radius shorthand. Expands to the four corner longhand properties so subsequent per-corner overrides win. https://lynxjs.org/api/css/properties/border-radius

Source

pub fn border_radius_full(self, v: BorderRadius) -> Self

Sets border-radius to a BorderRadius with per-corner control and optional elliptical second axis. Pushed as the shorthand because Lynx serializes elliptical corners via the / separator that has no longhand form. https://lynxjs.org/api/css/properties/border-radius

Source§

impl Css

Source

pub fn width(self, v: impl Into<Size>) -> Self

Sets width. Lynx default: auto. https://lynxjs.org/api/css/properties/width

Source

pub fn height(self, v: impl Into<Size>) -> Self

Sets height. Lynx default: auto. https://lynxjs.org/api/css/properties/height

Source

pub fn min_width(self, v: impl Into<Size>) -> Self

Sets min-width. Lynx default: 0. https://lynxjs.org/api/css/properties/min-width

Source

pub fn min_height(self, v: impl Into<Size>) -> Self

Sets min-height. Lynx default: 0. https://lynxjs.org/api/css/properties/min-height

Source

pub fn max_width(self, v: impl Into<Size>) -> Self

Sets max-width. Lynx default: none. https://lynxjs.org/api/css/properties/max-width

Source

pub fn max_height(self, v: impl Into<Size>) -> Self

Sets max-height. Lynx default: none. https://lynxjs.org/api/css/properties/max-height

Source

pub fn box_sizing(self, v: BoxSizing) -> Self

Sets box-sizing. Lynx default: border-box. https://lynxjs.org/api/css/properties/box-sizing

Source

pub fn aspect_ratio(self, width: f32, height: f32) -> Self

Sets aspect-ratio to <width> / <height>. https://lynxjs.org/api/css/properties/aspect-ratio

Source

pub fn padding_top(self, v: impl Into<LengthPercentage>) -> Self

Sets padding-top. Negative values are clamped to zero by Lynx. https://lynxjs.org/api/css/properties/padding-top

Source

pub fn padding_right(self, v: impl Into<LengthPercentage>) -> Self

Sets padding-right. Negative values are clamped to zero by Lynx. https://lynxjs.org/api/css/properties/padding-right

Source

pub fn padding_bottom(self, v: impl Into<LengthPercentage>) -> Self

Sets padding-bottom. Negative values are clamped to zero by Lynx. https://lynxjs.org/api/css/properties/padding-bottom

Source

pub fn padding_left(self, v: impl Into<LengthPercentage>) -> Self

Sets padding-left. Negative values are clamped to zero by Lynx. https://lynxjs.org/api/css/properties/padding-left

Source

pub fn margin_top(self, v: impl Into<MarginValue>) -> Self

Sets margin-top. Lynx allows negative values and auto. https://lynxjs.org/api/css/properties/margin-top

Source

pub fn margin_right(self, v: impl Into<MarginValue>) -> Self

Sets margin-right. Lynx allows negative values and auto. https://lynxjs.org/api/css/properties/margin-right

Source

pub fn margin_bottom(self, v: impl Into<MarginValue>) -> Self

Sets margin-bottom. Lynx allows negative values and auto. https://lynxjs.org/api/css/properties/margin-bottom

Source

pub fn margin_left(self, v: impl Into<MarginValue>) -> Self

Sets margin-left. Lynx allows negative values and auto. https://lynxjs.org/api/css/properties/margin-left

Source

pub fn gap(self, v: impl Into<LengthPercentage>) -> Self

Sets gap — shorthand for row-gap and column-gap. https://lynxjs.org/api/css/properties/gap

Source

pub fn row_gap(self, v: impl Into<LengthPercentage>) -> Self

Sets row-gap — inline gap between rows in flex/grid layouts. https://lynxjs.org/api/css/properties/row-gap

Source

pub fn column_gap(self, v: impl Into<LengthPercentage>) -> Self

Sets column-gap — gap between columns in flex/grid layouts. https://lynxjs.org/api/css/properties/column-gap

Source§

impl Css

Source

pub fn display(self, v: Display) -> Self

Sets display. Lynx default: linear. https://lynxjs.org/api/css/properties/display

Source

pub fn display_none(self) -> Self

Sets display: none — element is removed from the layout tree.

Source

pub fn display_flex(self) -> Self

Sets display: flex — opt into CSS flexbox.

Source

pub fn display_grid(self) -> Self

Sets display: grid — opt into CSS grid.

Source

pub fn display_linear(self) -> Self

Sets display: linear — Lynx default linear layout.

Source

pub fn display_relative(self) -> Self

Sets display: relative — Lynx relative-positioning container.

Source

pub fn direction(self, v: Direction) -> Self

Sets direction. Lynx default: ltr. https://lynxjs.org/api/css/properties/direction

Source§

impl Css

Source

pub fn opacity(self, v: f32) -> Self

Sets opacity. Lynx clamps to 0.0..=1.0. Default: 1. https://lynxjs.org/api/css/properties/opacity

Source

pub fn visibility(self, v: Visibility) -> Self

Sets visibility. Lynx default: visible. collapse is not supported. https://lynxjs.org/api/css/properties/visibility

Source

pub fn overflow(self, v: Overflow) -> Self

Sets overflow. Lynx accepts only visible and hidden. https://lynxjs.org/api/css/properties/overflow

Source

pub fn overflow_x(self, v: Overflow) -> Self

Source

pub fn overflow_y(self, v: Overflow) -> Self

Source

pub fn cursor(self, v: Cursor) -> Self

Source

pub fn pointer_events(self, v: PointerEvents) -> Self

Source

pub fn box_shadow( self, offset_x: Length, offset_y: Length, blur_radius: Length, spread_radius: Length, color: Color, ) -> Self

Sets box-shadow to a single shadow. Pass None for inset to get an outer shadow. https://lynxjs.org/api/css/properties/box-shadow

Source

pub fn box_shadow_inset( self, offset_x: Length, offset_y: Length, blur_radius: Length, spread_radius: Length, color: Color, ) -> Self

Source

pub fn filter(self, value: impl Into<String>) -> Self

Sets filter to a raw CSS filter list. Use raw because the <filter-function> grammar (blur, drop-shadow, etc.) is rich and rarely worth typing. https://lynxjs.org/api/css/properties/filter

Source

pub fn mask_image(self, value: impl Into<String>) -> Self

Sets mask-image to a raw CSS value (URL or gradient). https://lynxjs.org/api/css/properties/mask-image

Source

pub fn clip_path(self, value: impl Into<String>) -> Self

Sets clip-path to a raw CSS value. https://lynxjs.org/api/css/properties/clip-path

Source

pub fn caret_color(self, v: Color) -> Self

Source

pub fn outline_width(self, v: Length) -> Self

Source

pub fn outline_color(self, v: Color) -> Self

Source

pub fn outline_style(self, v: BorderStyle) -> Self

Source

pub fn outline_offset(self, v: Length) -> Self

Source

pub fn caret_width(self, v: Length) -> Self

Sets caret-width. Lynx accepts a length controlling the rendered caret thickness.

Source

pub fn x_handle_color(self, v: Color) -> Self

Sets -x-handle-color — Lynx-only selection-handle color. https://lynxjs.org/api/css/properties/-x-handle-color

Source

pub fn x_handle_size(self, v: impl Into<LengthPercentage>) -> Self

Sets -x-handle-size — Lynx-only selection-handle size. https://lynxjs.org/api/css/properties/-x-handle-size

Source

pub fn x_auto_font_size(self, enabled: bool) -> Self

Sets -x-auto-font-size — Lynx-only auto font-size flag. https://lynxjs.org/api/css/properties/-x-auto-font-size

Source

pub fn x_auto_font_size_preset_sizes( self, sizes: impl IntoIterator<Item = Length>, ) -> Self

Sets -x-auto-font-size-preset-sizes — Lynx-only list of preset sizes. https://lynxjs.org/api/css/properties/-x-auto-font-size-preset-sizes

Source§

impl Css

Source

pub fn flex_direction(self, v: FlexDirection) -> Self

Sets flex-direction. Lynx default: row. https://lynxjs.org/api/css/properties/flex-direction

Source

pub fn flex_wrap(self, v: FlexWrap) -> Self

Sets flex-wrap. Lynx default: nowrap. https://lynxjs.org/api/css/properties/flex-wrap

Source

pub fn flex_grow(self, v: f32) -> Self

Sets flex-grow. Lynx default: 0. Negative values are clamped to zero. https://lynxjs.org/api/css/properties/flex-grow

Source

pub fn flex_shrink(self, v: f32) -> Self

Sets flex-shrink. Lynx default: 1. Negative values are clamped to zero. https://lynxjs.org/api/css/properties/flex-shrink

Source

pub fn flex_basis(self, v: impl Into<FlexBasis>) -> Self

Sets flex-basis. Lynx default: auto. https://lynxjs.org/api/css/properties/flex-basis

Source

pub fn justify_content(self, v: JustifyContent) -> Self

Sets justify-content — main-axis distribution. https://lynxjs.org/api/css/properties/justify-content

Source

pub fn align_items(self, v: AlignItems) -> Self

Sets align-items — cross-axis alignment for all items. https://lynxjs.org/api/css/properties/align-items

Source

pub fn align_self(self, v: AlignSelf) -> Self

Sets align-self — cross-axis alignment for this item only. https://lynxjs.org/api/css/properties/align-self

Source

pub fn align_content(self, v: AlignContent) -> Self

Sets align-content — cross-axis distribution of wrapped lines. https://lynxjs.org/api/css/properties/align-content

Source

pub fn order(self, v: i32) -> Self

Sets order — controls layout order among flex/grid siblings. https://lynxjs.org/api/css/properties/order

Source§

impl Css

Source

pub fn grid_template_rows(self, v: GridTemplate) -> Self

Sets grid-template-rows — track-sizing along the block axis. https://lynxjs.org/api/css/properties/grid-template-rows

Source

pub fn grid_template_columns(self, v: GridTemplate) -> Self

Sets grid-template-columns — track-sizing along the inline axis. https://lynxjs.org/api/css/properties/grid-template-columns

Source

pub fn grid_auto_rows(self, v: GridTemplate) -> Self

Source

pub fn grid_auto_columns(self, v: GridTemplate) -> Self

Source

pub fn grid_auto_flow(self, v: GridAutoFlow) -> Self

Source

pub fn grid_row_start(self, v: GridLine) -> Self

Source

pub fn grid_row_end(self, v: GridLine) -> Self

Source

pub fn grid_column_start(self, v: GridLine) -> Self

Source

pub fn grid_column_end(self, v: GridLine) -> Self

Source

pub fn grid_row_gap(self, v: impl Into<LengthPercentage>) -> Self

Sets grid-row-gap (legacy alias for row-gap). https://lynxjs.org/api/css/properties/grid-row-gap

Source

pub fn grid_column_gap(self, v: impl Into<LengthPercentage>) -> Self

Sets grid-column-gap (legacy alias for column-gap). https://lynxjs.org/api/css/properties/grid-column-gap

Source§

impl Css

Source

pub fn linear_orientation(self, v: LinearOrientation) -> Self

Sets linear-orientation — Lynx’s analogue of flex-direction. https://lynxjs.org/api/css/properties/linear-orientation

Source

pub fn linear_direction(self, v: LinearOrientation) -> Self

Sets linear-direction — direction the linear container flows. https://lynxjs.org/api/css/properties/linear-direction

Source

pub fn linear_gravity(self, v: LinearGravity) -> Self

Sets linear-gravity — main-axis alignment. Deprecated; switch to display: flex + justify-content when possible. https://lynxjs.org/api/css/properties/linear-gravity

Source

pub fn linear_cross_gravity(self, v: LinearCrossGravity) -> Self

Sets linear-cross-gravity — cross-axis alignment for all items. https://lynxjs.org/api/css/properties/linear-cross-gravity

Source

pub fn linear_layout_gravity(self, v: LinearLayoutGravity) -> Self

Sets linear-layout-gravity — per-item cross-axis override. https://lynxjs.org/api/css/properties/linear-layout-gravity

Source

pub fn linear_weight(self, v: f32) -> Self

Sets linear-weight — relative size weight along the main axis. https://lynxjs.org/api/css/properties/linear-weight

Source

pub fn linear_weight_sum(self, v: f32) -> Self

Sets linear-weight-sum — denominator for weight calculations. https://lynxjs.org/api/css/properties/linear-weight-sum

Source§

impl Css

Source

pub fn position(self, v: PositionKind) -> Self

Sets position. Lynx default: relative. static is not supported by Lynx. https://lynxjs.org/api/css/properties/position

Source

pub fn top(self, v: impl Into<LengthPercentage>) -> Self

Sets top offset (positioned elements). https://lynxjs.org/api/css/properties/top

Source

pub fn right(self, v: impl Into<LengthPercentage>) -> Self

Sets right offset (positioned elements). https://lynxjs.org/api/css/properties/right

Source

pub fn bottom(self, v: impl Into<LengthPercentage>) -> Self

Sets bottom offset (positioned elements). https://lynxjs.org/api/css/properties/bottom

Source

pub fn left(self, v: impl Into<LengthPercentage>) -> Self

Sets left offset (positioned elements). https://lynxjs.org/api/css/properties/left

Source

pub fn inset_inline_start(self, v: impl Into<LengthPercentage>) -> Self

Sets inset-inline-start — logical start edge. https://lynxjs.org/api/css/properties/inset-inline-start

Source

pub fn inset_inline_end(self, v: impl Into<LengthPercentage>) -> Self

Sets inset-inline-end — logical end edge. https://lynxjs.org/api/css/properties/inset-inline-end

Source

pub fn z_index(self, v: i32) -> Self

Sets z-index. Lynx default: auto (no stacking context promotion). https://lynxjs.org/api/css/properties/z-index

Source§

impl Css

Source

pub fn relative_id(self, v: i32) -> Self

Sets relative-id — identifies the element for sibling-edge references. https://lynxjs.org/api/css/properties/relative-id

Source

pub fn relative_align_top(self, v: i32) -> Self

Sets relative-align-top — id of the sibling to top-align with. https://lynxjs.org/api/css/properties/relative-align-top

Source

pub fn relative_align_right(self, v: i32) -> Self

Sets relative-align-right — id of the sibling to right-align with. https://lynxjs.org/api/css/properties/relative-align-right

Source

pub fn relative_align_bottom(self, v: i32) -> Self

Source

pub fn relative_align_left(self, v: i32) -> Self

Source

pub fn relative_top_of(self, v: i32) -> Self

Sets relative-top-of — id of the sibling this element sits below. https://lynxjs.org/api/css/properties/relative-top-of

Source

pub fn relative_right_of(self, v: i32) -> Self

Sets relative-right-of — id of the sibling this element sits to the right of. https://lynxjs.org/api/css/properties/relative-right-of

Source

pub fn relative_bottom_of(self, v: i32) -> Self

Source

pub fn relative_left_of(self, v: i32) -> Self

Source

pub fn relative_center(self, v: i32) -> Self

Sets relative-center — centers the element relative to a sibling. https://lynxjs.org/api/css/properties/relative-center

Source

pub fn relative_center_horizontal(self, v: i32) -> Self

Sets relative-center-horizontal — centers horizontally only. https://lynxjs.org/api/css/properties/relative-center-horizontal

Source

pub fn relative_center_vertical(self, v: i32) -> Self

Sets relative-center-vertical — centers vertically only. https://lynxjs.org/api/css/properties/relative-center-vertical

Source

pub fn relative_layout_once(self, v: bool) -> Self

Sets relative-layout-once — performs the relative-layout pass only on the first render. https://lynxjs.org/api/css/properties/relative-layout-once

Source

pub fn relative_align_inline_start(self, v: i32) -> Self

Sets relative-align-inline-start (logical-direction alias).

Source

pub fn relative_align_inline_end(self, v: i32) -> Self

Sets relative-align-inline-end (logical-direction alias).

Source

pub fn relative_inline_start_of(self, v: i32) -> Self

Sets relative-inline-start-of.

Source

pub fn relative_inline_end_of(self, v: i32) -> Self

Sets relative-inline-end-of.

Source§

impl Css

Source

pub fn text_align(self, v: TextAlign) -> Self

Sets text-align. justify is not supported by Lynx. https://lynxjs.org/api/css/properties/text-align

Source

pub fn text_decoration_line(self, v: TextDecorationLine) -> Self

Sets text-decoration-line (single value). https://lynxjs.org/api/css/properties/text-decoration-line

Source

pub fn text_decoration_style(self, v: TextDecorationStyle) -> Self

Source

pub fn text_decoration_color(self, v: Color) -> Self

Source

pub fn text_decoration_thickness(self, v: Length) -> Self

Source

pub fn text_overflow(self, v: TextOverflow) -> Self

Source

pub fn text_transform(self, v: TextTransform) -> Self

Source

pub fn text_indent(self, v: impl Into<LengthPercentage>) -> Self

Sets text-indent — first-line indentation. https://lynxjs.org/api/css/properties/text-indent

Source

pub fn vertical_align(self, v: VerticalAlign) -> Self

Source

pub fn white_space(self, v: WhiteSpace) -> Self

Source

pub fn word_break(self, v: WordBreak) -> Self

Source

pub fn word_wrap(self, v: WordWrap) -> Self

Sets word-wrap (also known as overflow-wrap). https://lynxjs.org/api/css/properties/word-wrap

Source

pub fn overflow_wrap(self, v: WordWrap) -> Self

Sets overflow-wrap — synonym of word-wrap. https://lynxjs.org/api/css/properties/overflow-wrap

Source

pub fn webkit_line_clamp(self, v: u32) -> Self

Sets -webkit-line-clamp — limit the visible line count. https://lynxjs.org/api/css/properties/-webkit-line-clamp

Source

pub fn text_stroke_width(self, v: Length) -> Self

Source

pub fn text_stroke_color(self, v: Color) -> Self

Source§

impl Css

Source§

impl Css

Source

pub fn transition_property(self, v: TransitionPropertyKind) -> Self

Sets transition-property — the property to transition. https://lynxjs.org/api/css/properties/transition-property

Source

pub fn transition_duration(self, v: Time) -> Self

Source

pub fn transition_timing_function(self, v: EasingFunction) -> Self

Source

pub fn transition_delay(self, v: Time) -> Self

Sets transition-delay. Negative delays cause the transition to begin partway through its progression. https://lynxjs.org/api/css/properties/transition-delay

Source§

impl Css

Source

pub fn font_family(self, v: impl Into<String>) -> Self

Sets font-family. Pass a single family name; for multiple families, call this method once per family or use the Css::raw escape hatch with a comma-separated list. https://lynxjs.org/api/css/properties/font-family

Source

pub fn font_size(self, v: impl Into<LengthPercentage>) -> Self

Sets font-size. Lynx default: 14px. https://lynxjs.org/api/css/properties/font-size

Source

pub fn font_style(self, v: FontStyle) -> Self

Sets font-style. Lynx default: normal. https://lynxjs.org/api/css/properties/font-style

Source

pub fn font_weight(self, v: FontWeight) -> Self

Sets font-weight. Lynx default: normal. bolder/lighter are not supported. https://lynxjs.org/api/css/properties/font-weight

Source

pub fn font_variant(self, v: FontVariant) -> Self

Source

pub fn letter_spacing(self, v: Length) -> Self

Sets letter-spacing. Accepts <length>. https://lynxjs.org/api/css/properties/letter-spacing

Source

pub fn line_height(self, v: impl Into<LineHeight>) -> Self

Sets line-height. Lynx default: normal. https://lynxjs.org/api/css/properties/line-height

Source§

impl Css

Source

pub fn animation(self, a: Animation) -> Self

Sets the animation shorthand for a single animation. https://lynxjs.org/api/css/properties/animation

Source

pub fn animations(self, anims: impl IntoIterator<Item = Animation>) -> Self

Sets the animation shorthand for multiple comma-separated animations.

Source§

impl Css

Source

pub fn background(self, b: Background) -> Self

Sets the background shorthand. https://lynxjs.org/api/css/properties/background

Source§

impl Css

Source

pub fn border(self, b: Border) -> Self

Sets border for all four sides. Equivalent to setting border-top, border-right, border-bottom, border-left individually. https://lynxjs.org/api/css/properties/border

Source

pub fn border_top(self, b: Border) -> Self

Source

pub fn border_right(self, b: Border) -> Self

Source

pub fn border_bottom(self, b: Border) -> Self

Source

pub fn border_left(self, b: Border) -> Self

Source§

impl Css

Source

pub fn flex(self, v: Flex) -> Self

Sets flex shorthand — expands to flex-grow, flex-shrink, flex-basis. https://lynxjs.org/api/css/properties/flex

Source§

impl Css

Source

pub fn padding(self, v: impl Into<Padding>) -> Self

Sets padding shorthand. Expands to the four per-side longhands so later overrides win cleanly. The argument accepts a single length, a (y, x) tuple, a (t, x, b) tuple, or a (t, r, b, l) tuple. https://lynxjs.org/api/css/properties/padding

Source

pub fn margin(self, v: impl Into<Margin>) -> Self

Sets margin shorthand. Same shape rules as Css::padding, with auto allowed per side. https://lynxjs.org/api/css/properties/margin

Source§

impl Css

Source

pub fn transform(self, t: impl Into<Transform>) -> Self

Sets transform to a list of TransformFns. Functions are applied left-to-right. https://lynxjs.org/api/css/properties/transform

Source§

impl Css

Source

pub fn transition(self, t: Transition) -> Self

Sets the transition shorthand for a single transition. https://lynxjs.org/api/css/properties/transition

Source

pub fn transitions(self, ts: impl IntoIterator<Item = Transition>) -> Self

Sets the transition shorthand for multiple comma-separated transitions.

Trait Implementations§

Source§

impl Clone for Css

Source§

fn clone(&self) -> Css

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Css

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Css

Source§

fn default() -> Css

Returns the “default value” for a type. Read more
Source§

impl Display for Css

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Css

Source§

impl From<&Css> for String

Source§

fn from(s: &Css) -> Self

Converts to this type from the input type.
Source§

impl From<Css> for String

Source§

fn from(s: Css) -> Self

Converts to this type from the input type.
Source§

impl Hash for Css

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Css

Source§

fn eq(&self, other: &Css) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Css

Source§

impl ToCss for Css

Source§

fn to_css(&self, dest: &mut dyn Write) -> Result

Write the CSS representation of self into dest.
Source§

fn to_css_string(&self) -> String

Convenience: allocate a fresh String and write into it.

Auto Trait Implementations§

§

impl Freeze for Css

§

impl RefUnwindSafe for Css

§

impl Send for Css

§

impl Sync for Css

§

impl Unpin for Css

§

impl UnsafeUnpin for Css

§

impl UnwindSafe for Css

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.