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

Detailed explanation of Vue's custom event content distribution

1. This is a bit complicated to understand, I hop...

Detailed explanation of the implementation of shared modules in Angular projects

Table of contents 1. Shared CommonModule 2. Share...

React Native scaffolding basic usage detailed explanation

Build the project Execute the command line in the...

Implementation steps of vue-element-admin to build a backend management system

Recently, when I was working on a conference heal...

Implementing a simple carousel based on JavaScript

This article shares the specific code of JavaScri...

Analysis of the Principle of MySQL Index Length Limit

This article mainly introduces the analysis of th...

A simple way to restart QT application in embedded Linux (based on QT4.8 qws)

Application software generally has such business ...

Web design and production test questions and reference answers

<br />Web Design and Production Test Part I ...

Native JS to implement breathing carousel

Today I will share with you a breathing carousel ...

How to choose the format when using binlog in MySQL

Table of contents 1. Three modes of binlog 1.Stat...

User Experience Summary

Nowadays, whether you are working on software or w...

Vue implements countdown between specified dates

This article example shares the specific code of ...

Summary of several APIs or tips in HTML5 that cannot be missed

In previous blog posts, I have been focusing on so...