“Grid and flexbox. The basic difference between CSS Grid Layout and CSS Flexbox Layout is that flexbox was designed for layout in one dimension - either a row or a column. Grid was designed for two-dimensional layout - rows, and columns at the same time.”
In your example we have the following:
When you set a ‘flex’ value for the display property you get one row with two HTML elements side by side (one-dimensional flexbox container: from left to right). When it comes to the ‘grid’ value for the same property, you get two elements in one column: “Some text”, and ‘em’ (two-dimensional grid container - one column and two rows - from left to right and from top to bottom). “span” becomes grid container. To understand better, press F12 and change the screen size on the left. Of course, both ‘display’ properties usually go with one or more corresponding properties. For example:
display: grid;
grid-template-columns: auto auto auto;