Flex layout allows subitems to maintain their own height

Flex layout allows subitems to maintain their own height

When using Flex layout, you will find that when arranged horizontally, the height of all child items becomes the same.


This is because Flex layout will default to:

  • Arrange all subitems horizontally.
  • By default, no automatic line wrapping is enabled.
  • Makes the child the same width as its content and sets the height of all children to the height of the tallest child.

It is very inconvenient to set the background color in this way. Then you can set align-items to flex-start or other values ​​of the align-items attribute on the parent item, and the child item will maintain its own height.

.fat{
	display: flex;
	align-items:flex-start;
}

The effect is as follows:

This is the end of this article about how to use Flex layout to keep child items at their own height. For more information about how to use Flex layout to keep child items at their own height, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  Use viewport in meta tag to define screen css

>>:  Specific use of Mysql prepare preprocessing

Recommend

How to implement Vue timer

This article example shares the specific code of ...

Solution to MySQL connection exception and error 10061

MySQL is a relational database management system ...

18 Amazing Connections Between Interaction Design and Psychology

Designers need to understand psychology reading n...

Introduction to the use of base link tag base

<br />When you click the link, the web page ...

WeChat applet implements video player sending bullet screen

This article shares the specific code for WeChat ...

Detailed explanation of how to efficiently import multiple .sql files into MySQL

MySQL has multiple ways to import multiple .sql f...

Steps for packaging and configuring SVG components in Vue projects

I just joined a new company recently. After getti...

VUE introduces the implementation of using G2 charts

Table of contents About G2 Chart use Complete cod...

Docker Getting Started Installation Tutorial (Beginner Edition)

Doccer Introduction: Docker is a container-relate...

How to import Chinese data into csv in Navicat for SQLite

This article shares with you the specific method ...

js implements a simple English-Chinese dictionary

This article shares the specific code of js to im...

Solution to MySQLSyntaxErrorException when connecting to MySQL using bitronix

Solution to MySQLSyntaxErrorException when connec...