Contact Us | +1 888 239-0733 (Toll free US/CA) Mon-Fri: 7:30am to 4:30pm (PST)

CSS 'block-size' Property Explained

Est. Reading: 2 minutes
Posted: April 1, 2024

The CSS 'block-size' property specifies the size of an element's block or vertical size in a standard writing mode. It defines the height of an element in a layout where the writing mode is horizontal (like in English and most Western languages), effectively controlling how tall an element is. This property is particularly useful for layouts that need to adapt to different writing modes or when you want to set the size of a block-level element explicitly.

CSS 'block-size' Property Examples

See the Pen CSS 'block-size' Property by Webzstore (@webzstore) on CodePen.

The 'block-size' property offers a robust way to manage the vertical dimensions of elements across different layouts and writing modes, enhancing CSS's capabilities for responsive and internationalized web design.

Browser Support For 'block-size' Property

FirefoxSafariChromeMicrosoft EdgeOpera
41.012.157.079.044.0

CSS Syntax of the 'block-size' Property

block-size: auto | length | percentage | initial | inherit ;

Usage of the 'block-size' Property

Use 'block-size' to explicitly set an element's vertical size. This is especially relevant in responsive designs or when working with grid and flex layouts, where the size of elements may need to adjust based on content, viewport dimensions, or specific design requirements. The 'block-size' property is also essential when dealing with internationalization, as it helps manage layouts that involve different writing modes.

Property Values of the 'background' Property

  • Auto: The browser calculates the block size. This is the default and is often based on the content size.
  • Length: Defines the block size with a fixed size, using units such as pixels (px), ems (em), or any other length unit.
  • Percentage: Sets the block size relative to the containing block's size.
  • Initial: Resets the 'block-size' to its default value (auto).
  • Inherit: Inherits the 'block-size' from the parent element.

Ryan Parker

Ryan has been a standout in digital marketing since 2010. He's the go-to person for getting businesses noticed online, with over 300 projects under his belt—these range from helping local business owners to big online stores. As the Head of Digital Marketing at Webzstore Solutions, Ryan knows all the tricks to make companies shine on the internet. He's excellent at using the latest tech and smart strategies to get results. Ryan is all about making businesses grow and reach more people online.

chevron-down