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.
Design a layout where nested grids share track sizes with their parent via subgrid. Copy the complete CSS.
Create a pure CSS scroll progress indicator using animation‑timeline: scroll(). No JavaScript. Copy the complete code.
Paste your CSS and see warnings for properties that have limited browser support. Links to CanIUse. Modernize safely.
Limit browser gestures on an element: pan‑x, pinch‑zoom, manipulation. Draw on a canvas to test. Mobile dev helper.
Create complex linear gradients with any number of color stops, exact angles, and length units. Live preview and CSS code.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Generate a random HTML/CSS card with different box model properties. Inspect and guess the size. For learners.
Design a button or card that glows on hover. Adjust shadow color, spread, and transition. Copy the CSS. Rich UI.
Create a realistic letterpress (debossed) text effect using CSS text‑shadow and background. Adjust depth and light direction. Copy code.
Experiment with CSS container queries. Resize a container and see the styles change according to its size, not the viewport. Learn the new spec.
Paste your CSS and sort the properties of each rule alphabetically or by concentric groups. Keep your stylesheets consistent without a build step.
Generate a subtle noise/grain texture as a CSS background pattern. Adjust opacity and size. For that film look.
Create a customizable checkerboard or grid background using pure CSS gradients. Adjust cell size and colors. Copy the code.
Upload two images and apply CSS blend modes (multiply, screen, overlay, etc.). See the result and copy the filter CSS. Pure frontend.
Add print styles like removing backgrounds, adding page breaks, setting margins. See print preview instantly.
Create a pure CSS countdown timer with a flipping number effect. Adjust duration and style. No JavaScript needed for display.
Paste HTML/CSS snippets or enter properties to test how z‑index and stacking contexts interact. Real‑time example.
Create a glowing or rotating border animation around an element. Copy the CSS keyframes. Pure CSS magic.
Create a custom HTML/CSS progress bar with percentage, colors, and animation. Copy the code. Modern UI element.
Design a realistic neon sign text with multiple layers of glow. Copy the CSS and HTML. Perfect for headers.
A replica of the famous Flexbox Froggy game: solve alignment puzzles by writing CSS. Progress saved locally. Fun frontend learning.
Fetch a website's CSS and extract :root custom properties (‑‑color) to reveal its design token palette. For learning and inspiration.
Recreate the target CSS linear gradient by adjusting stops and colors. A unique game for front‑end developers to master gradients.
Browse and search all Font Awesome 6 icons with preview, class name, and unicode. Copy the HTML snippet. Perfect for web developers.
Create text with a gradient fill using CSS background-clip. Configure colors and direction. Copy the code. Works in modern browsers.
A complete, searchable list of all 140+ named HTML/CSS colors with their hex codes and color previews. Click to copy code. Essential web reference.
Visually experiment with Flexbox container and item properties. See the layout update in real time and copy the CSS. Learn by doing, fully interactive.
Minify JavaScript and CSS code to reduce file size for production. Remove whitespace and comments instantly. Run locally, your code stays private.
Easily create asymmetric border radius values and preview the result. Copy the generated CSS instantly. All interactively and browser-based.