#[non_exhaustive]pub enum Length<const DEFAULT_AUTO: bool = true> {
}Expand description
Represents a value that can be a specific length, percentage, or automatic.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auto
Automatic sizing based on content
Percentage(f32)
Percentage value relative to parent container (0-100)
Rem(f32)
Rem value relative to the root font size
Em(f32)
Em value relative to the font size
Lh(f32)
Lh value relative to the element’s computed line-height
Rlh(f32)
Rlh value relative to the root element’s computed line-height
Vh(f32)
Vh value relative to the viewport height (0-100)
Vw(f32)
Vw value relative to the viewport width (0-100)
CqH(f32)
Cqh value relative to the query container height (0-100)
CqW(f32)
Cqw value relative to the query container width (0-100)
CqMin(f32)
Cqmin value relative to the query container smaller dimension (0-100)
CqMax(f32)
Cqmax value relative to the query container larger dimension (0-100)
VMin(f32)
Vmin value relative to the smaller viewport dimension (0-100)
VMax(f32)
Vmax value relative to the larger viewport dimension (0-100)
Cm(f32)
Centimeter value
Mm(f32)
Millimeter value
In(f32)
Inch value
Q(f32)
Quarter value
Pt(f32)
Point value
Pc(f32)
Picas value
Px(f32)
Specific pixel value
Calc(CalcFormula)
calc(…) expression
Implementations§
Source§impl<const DEFAULT_AUTO: bool> Length<DEFAULT_AUTO>
impl<const DEFAULT_AUTO: bool> Length<DEFAULT_AUTO>
Sourcepub fn from_spacing(units: f32) -> Self
pub fn from_spacing(units: f32) -> Self
Construct a length from a Tailwind spacing-scale multiplier.
Source§impl<const DEFAULT_AUTO: bool> Length<DEFAULT_AUTO>
impl<const DEFAULT_AUTO: bool> Length<DEFAULT_AUTO>
pub fn to_compact_length(self, sizing: &SizingContext) -> CompactLength
pub fn resolve_to_length_percentage( self, sizing: &SizingContext, ) -> LengthPercentage
pub fn to_px(self, sizing: &SizingContext, percentage_full_px: f32) -> f32
pub fn resolve_to_length_percentage_auto( self, sizing: &SizingContext, ) -> LengthPercentageAuto
pub fn resolve_to_dimension(self, sizing: &SizingContext) -> Dimension
Trait Implementations§
impl<const DEFAULT_AUTO: bool> Copy for Length<DEFAULT_AUTO>
Source§impl From<Length> for PositionComponent
impl From<Length> for PositionComponent
Source§impl From<Length> for LineHeight
impl From<Length> for LineHeight
Source§impl From<PositionComponent> for Length
impl From<PositionComponent> for Length
Source§fn from(component: PositionComponent) -> Self
fn from(component: PositionComponent) -> Self
Source§impl<'i, const DEFAULT_AUTO: bool> FromCss<'i> for Length<DEFAULT_AUTO>
impl<'i, const DEFAULT_AUTO: bool> FromCss<'i> for Length<DEFAULT_AUTO>
Source§const VALID_TOKENS: &'static [CssToken]
const VALID_TOKENS: &'static [CssToken]
Source§fn from_css(input: &mut Parser<'i, '_>) -> ParseResult<'i, Self>
fn from_css(input: &mut Parser<'i, '_>) -> ParseResult<'i, Self>
Parser instance.