Using the new two-value syntax of the display property in CSS

๐Ÿ“– Neural networks for Javascript developers

The Neural Networks for JavaScript developers book is almost ready! Learn the basics of AI with TensorFlowJs examples. Join now the presale and get a 15$ coupon off the launching price!

Changes are coming to one of the core properties in CSS: the display property. We will be able to define how our elements are behaving when relating to their children and how they relate to their siblings.

The new syntax of the display property will accept two parameters <display-outside> and <display-inside>.

For example, when we are saying display: grid we are basically saying two things:

  • this element is a grid for its children
  • and this element is a block for its siblings

So the full declaration can be display: block grid.

The same with display inline-grid. It is a grid for its children and an inline for its siblings. So with the new syntax, it will become display: inline grid.

In this Web docs Mozilla article we have the following table describing the correspondence between the old and new syntax.

Current value New value
block block flow
flow-root block flow-root
inline inline flow
inline-block inline flow-root
flex block flex
inline-flex inline flex
grid block grid
inline-grid inline grid

As a general rule if a <display-outside> value is specified but <display-inside> is omitted, the elementโ€™s inner display type defaults to flow.

So far only Firefox fully implements this new syntax but I am looking forward to more support as I think it provides a clearer description of how an element behaves.

If you want to read more and you can take a look at this great article or Rachel Andrew or the below video:

๐Ÿ“– Neural networks for Javascript developers

The Neural Networks for JavaScript developers book is almost ready! Learn the basics of AI with TensorFlowJs examples. Join now the presale and get a 15$ coupon off the launching price!


Leave a Reply

Your email address will not be published. Required fields are marked *

Home Screencasts Best of Newsletter Search X

Neural Networks for JavaScript developers
Presale - 15$ free coupon

Hi friend! Before you go, just wanted to let you know that in March 2023 I will be launching the TensorFlow.Js by Example course.

This course will include basic concepts of AI and Neural Networks done with TensorFlowJs such as:

  • Working with datasets
  • Visualizing training
  • Deep Neural Networks in JavaScript
  • Reinforcement Learning
  • Convolutional neural networks
  • and much more ...

Also, there will be a lot of examples as:

  • Object detection
  • Natural language processing
  • Face and voice recognition
  • Gaming AI

Join now the waiting list and get a 15$ coupon off the launching price!

X