pub enum CssLength {
Px(f64),
Em(f64),
Rem(f64),
Vw(f64),
Vh(f64),
Percent(f64),
}Expand description
CSS length unit with numeric value.
Represents the subset of CSS <length> and <percentage> values
relevant to WCAG spatial constraints.
Variants§
Px(f64)
Absolute pixels.
Em(f64)
Relative to font size.
Rem(f64)
Relative to root font size.
Vw(f64)
Percentage of viewport width.
Vh(f64)
Percentage of viewport height.
Percent(f64)
Percentage of containing block.
Implementations§
Source§impl CssLength
impl CssLength
Sourcepub fn to_px(
&self,
font_size_px: f64,
root_font_size_px: f64,
viewport_width: f64,
viewport_height: f64,
containing_block: f64,
) -> f64
pub fn to_px( &self, font_size_px: f64, root_font_size_px: f64, viewport_width: f64, viewport_height: f64, containing_block: f64, ) -> f64
Resolve to absolute pixels given a context.
font_size_px: current element’s computed font sizeroot_font_size_px: root element’s font size (default 16)viewport_width: viewport width in pxviewport_height: viewport height in pxcontaining_block: containing block dimension in px (for %)
Trait Implementations§
impl Copy for CssLength
Source§impl<'de> Deserialize<'de> for CssLength
impl<'de> Deserialize<'de> for CssLength
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for CssLength
Auto Trait Implementations§
impl Freeze for CssLength
impl RefUnwindSafe for CssLength
impl Send for CssLength
impl Sync for CssLength
impl Unpin for CssLength
impl UnsafeUnpin for CssLength
impl UnwindSafe for CssLength
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more