size‑container Demo - Online Intrinsic & Styled Queries
Explore the size‑container and inline‑size CSS properties for container queries. Understand containment contexts. Visual guide.
UD5 Toolkit
Explore block-size & inline-size — the writing-mode-aware alternatives to width and height
CSS logical sizing properties — block-size and inline-size — are writing-mode-aware alternatives to the traditional physical properties width and height. Instead of referring to fixed screen directions (horizontal/vertical), they refer to the block axis (the direction blocks of text stack) and the inline axis (the direction text flows). This means they automatically adapt when the writing-mode changes — essential for multilingual websites supporting languages like Japanese, Chinese, Arabic, or Mongolian that use different writing directions.
In a standard horizontal writing mode (horizontal-tb), block-size behaves exactly like height — they both control the vertical dimension. However, switch to a vertical writing mode like vertical-rl, and block-size suddenly controls the horizontal dimension (width), while height stubbornly remains vertical. This is the key advantage: logical properties follow the meaning of your layout, not fixed screen coordinates. Use block-size when you want to size along the block-stacking direction regardless of writing mode.
inline-size controls the dimension along the inline (text flow) axis. In horizontal-tb mode, it equals width. In vertical-rl mode, it equals height. Think of it as "how wide is my text line?" — in horizontal writing, lines stretch horizontally (width); in vertical writing, lines stretch vertically (height). Using inline-size ensures your element's line-length stays consistent across writing modes without manual adjustments.
Yes! block-size and inline-size have excellent browser support — they work in all modern browsers including Chrome (69+), Firefox (41+), Safari (12.1+), and Edge (79+). Global support exceeds 96% of users. Other logical properties like margin-block, padding-inline, and border-block are also widely supported. For production use, consider adding physical-property fallbacks for very old browsers, though this is increasingly unnecessary.
Use logical properties whenever your layout's meaning is tied to text flow rather than screen coordinates. Key scenarios: (1) Multilingual websites that switch between horizontal and vertical writing modes; (2) Reusable components that need to work in any writing context; (3) Internationalization (i18n) projects targeting languages like Japanese, Chinese, Korean, Arabic, or Hebrew; (4) When using CSS Grid or Flexbox with logical alignment values. Even for English-only sites, adopting logical properties future-proofs your code and enforces better layout thinking.
The CSS Logical Properties specification is comprehensive. Beyond sizing, you'll find: Margin/Padding — margin-block-start, margin-inline-end, padding-block, padding-inline (shorthand for both sides on an axis); Borders — border-block-start, border-inline-end; Positioning — inset-block-start, inset-inline-end (replacing top, right, bottom, left); Overflow — overflow-block, overflow-inline; and Resize — resize: block, resize: inline. Together they form a complete system for direction-agnostic layout.
Logical properties respect both writing-mode and direction (LTR/RTL). For sizing properties like block-size and inline-size, the direction doesn't change the actual size — but logical margin/padding/inset properties do flip appropriately. For example, margin-inline-start will be on the left in LTR and on the right in RTL. This eliminates the need for separate RTL stylesheets or complex selector overrides, making bidirectional layouts dramatically simpler to implement and maintain.
Absolutely! block-size and inline-size are fully animatable with CSS transitions and animations, just like width and height. You can use transition: block-size 0.3s ease, inline-size 0.3s ease; to create smooth resizing effects. They also work with @keyframes animations. What's particularly powerful is animating writing-mode changes combined with logical properties — the browser recalculates dimensions as the writing mode shifts, though note that writing-mode itself is a discrete property (no smooth interpolation between modes).
Explore the size‑container and inline‑size CSS properties for container queries. Understand containment contexts. Visual guide.
Make an element resizable horizontally, vertically, or both. See the handle and code. Useful for textareas.
Type a few words and see them rendered at every heading size (h1–h6) with your chosen font. Perfect for design systems.
Select any element on the test page and monitor its size changes with ResizeObserver. See log of all entries.
Enter item dimensions and find the smallest rectangular box that can fit them (simple packing heuristic). Helps reduce shipping costs. Local algorithm.
Drag to resize a box and see the Resize Observer callback fire. Get contentRect and borderBoxSize. Learn the API.
See how scroll‑padding and scroll‑margin affect the position of elements when using anchor links or scroll‑snap. Visual.
Toggle print‑specific styles like removing backgrounds, showing link URLs, and adding page breaks. Generate a complete print stylesheet instantly.
Enter two tire sizes and see a side‑by‑side comparison of diameter, width, and speedometer error. Local math.
Calculate the appropriate hide box dimensions based on your reptile’s length and girth. A snug hide reduces stress and promotes natural behavior.
Enter head circumference to get crown diameter and length. Perfect fit top‑down hats.
Enter baby's weight in lbs or kg to see suggested diaper sizes across major brands. General reference, no data collected.
Enter your hammock length to get the ideal fixed ridgeline length (83% of hammock length). Achieve a consistent, comfortable sag.
Enter image pixel dimensions and compute maximum print size at various DPI. With aspect ratio presets (4x6, 5x7, 8x10) and cropping preview. Local tool.
Enter viewing distance to get the minimum readable print font size. Design posters and signs.
Find out how large you can print based on image resolution in pixels. Understand DPI and megapixels.
Enter length, width, thickness to approximate surfboard volume. Compare to your ideal volume based on weight.
Enter megapixels and desired DPI to see the maximum print size without upscaling. Quick quality check.
Add print styles like removing backgrounds, adding page breaks, setting margins. See print preview instantly.
Knit a swatch, measure before and after felting, and let this tool calculate the shrink percentage. Plan your felted projects accurately.
Estimate board feet of spray foam needed for a cavity. Compare closed‑cell and open‑cell.
Select bird species and toy type to see potential hazards and size recommendations.
Add appliances with running and starting watts to estimate needed generator capacity. Prevent overload.
Enter current ball size and target to find approx rubber bands required. Fun and satisfying.
Paste a raster image and an SVG, see the file size and rendering time. Understand when to use vector. Local.
Apply will‑change to any element and see its effect on compositing. Learn best practices for smooth animations.
Demonstrate how to add custom headers and POST‑like functionality to EventSource using a polyfill. Code and example.
Estimate filament usage: enter weight or length and get the remaining value plus cost. PLA/ABS density reference. Local calculation.
Enter your snake's weight and species to get recommended rodent size and feeding frequency. Avoid under/overfeeding.
Look at a color‑coded BMI table for your height and see the healthy weight range. Simple reference.