Layout
Native Fluid Sizing
ModulateCSS leverages CSS custom properties, CSS Calc, and CSS Clamp to implement fluid sizing techniques, providing a robust CSS-only solution that eliminates the need for SCSS or external tools. This method contrasts traditional approaches that rely on breakpoints, which often result in abrupt changes in sizing at specific screen widths.
Fluid sizing enables typography and other design elements to adapt smoothly across different devices without the sudden leaps associated with breakpoints. It utilizes linear interpolation between specified minimum and maximum values to generate scalable designs that adjust effectively across various screen sizes.
This method is especially beneficial for handling fixed design drafts that only include mobile and desktop views. It simplifies the typically challenging task of accommodating all intermediate device sizes.
Advantages of Fluid Sizing
- Comprehensive Responsiveness: Affects typography, margins, paddings, and more to ensure uniformity across devices.
- Enhanced Customizability: Allows precise control over the responsive behavior of each element.
- Streamlined Development: Employs custom CSS properties and internal calculations for straightforward implementation.
Setup
Global Settings
Set global minimum and maximum screen sizes and base font size at the :root
level.
Basic Usage
For each design element, set up custom properties for fluid behavior:
Replace --fp-min
and --fp-max
with appropriate values for properties like font-size, line-height, letter-spacing, and more to ensure seamless adaptation across different devices.
Available Fluid Properties
Below you'll find all properties available in ModulateCSS for implementing fluid sizing, designed to enhance responsiveness and adaptability across different devices. Note that traditional properties like top
, left
, bottom
, and right
are not supported; instead, only logical properties are utilized. Each entry specifies which traditional properties are replaced by these logical counterparts to ensure compatibility and flexibility in layout design.
Text
font-size
Font Size
line-height
Line
Height
letter-spacing
Letter Spacing
word-spacing
Word Spacing
text-indent
Text Indent Text Indent Text Indent Text Indent
text-decoration-thickness
Text Decoration Thickness
text-underline-offset
Text Underline Offset
Block
block-size replaces height
Block Size
min-block-size replaces min-height
Min Block Size
max-block-size replaces max-height
Max Block Size
Inline
inline-size replaces width
Inline Size
min-inline-size replaces min-width
Min Inline Size
max-inline-size replaces max-width
Max Inline Size
Margin
margin
Margin
margin-block replaces margin-top
+ margin-bottom
Margin Block
margin-block-start replaces margin-top
Margin Block Start
margin-block-end replaces margin-bottom
Margin Block End
margin-inline replaces margin-left
+ margin-right
Margin Inline
margin-inline-start replaces margin-left
Margin Inline Start
margin-inline-end replaces margin-right
Margin Inline End
Padding
padding
Padding
padding-block replaces padding-top
+ padding-bottom
Padding Block
padding-block-start replaces padding-top
Padding Block Start
padding-block-end replaces padding-bottom
Padding Block End
padding-inline replaces padding-left
+ padding-right
Padding Inline
padding-inline-start replaces padding-left
Padding Inline Start
padding-inline-end replaces padding-right
Padding Inline End
Border Width
border-width
Border Width
border-block-width replaces border-top-width
+ border-bottom-width
Border Block Width
border-block-start-width replaces border-top-width
Border Block Start Width
border-block-end-width replaces border-bottom-width
Border Block End Width
border-inline-width replaces border-left-width
+ border-right-width
Border Inline Width
border-inline-start-width replaces border-left-width
Border Inline Start Width
border-inline-end-width replaces border-right-width
Border Inline End Width
Border Radius
border-radius
Border Radius
border-start-start-radius replaces border-top-left-radius
Border Start Start Radius
border-start-end-radius replaces border-top-right-radius
Border Start End Radius
border-end-end-radius replaces border-bottom-right-radius
Border End End Radius
border-end-start-radius replaces border-bottom-left-radius
Border End Start Radius
Outline
outline-width
outline-offset
Inset
inset
inset-block replaces top
+ bottom
inset-block-start replaces top
inset-block-end replaces bottom
inset-inline replaces left
+ right
inset-inline-start replaces left
inset-inline-end replaces right
Grid, Flex and Columns
grid-auto-columns
grid-auto-rows
gap
column-gap
row-gap
column-width
column-rule-width
flex-basis
Background
background-position-x
background-position-y
Scroll
scroll-margin
scroll-margin-block replaces scroll-margin-top
+ scroll-margin-bottom
scroll-margin-block-start replaces scroll-margin-top
scroll-margin-block-end replaces scroll-margin-bottom
scroll-margin-inline replaces scroll-margin-left
+ scroll-margin-right
scroll-margin-inline-start replaces scroll-margin-left
scroll-margin-inline-end replaces scroll-margin-right
scroll-padding
scroll-padding-block replaces scroll-padding-top
+ scroll-padding-bottom
scroll-padding-block-start replaces scroll-padding-top
scroll-padding-block-end replaces scroll-padding-bottom
scroll-padding-inline replaces scroll-padding-left
+ scroll-padding-right
scroll-padding-inline-start replaces scroll-padding-left
scroll-padding-inline-end replaces scroll-padding-right