Full understanding of Flex usage _flex

Source: Internet
Author: User

One, you can use Flex to layout a div inside another div horizontally vertically centered

such as: HTML code:

<div class= "Container" >
	<div class= "box" >

	</div>
	</div>

CSS code:

. container{
	width:600px;
	height:400px;
	BORDER:1PX solid blue;
	Display:flex;
	Justify-content:center;
	Align-items:center
	}
	. box{
	width:200px;
	height:100px;
	BORDER:1PX Red Solid;

PS: This can be horizontally vertically centered slightly

Second, the properties of Flex

<div class= "Items" >
	<div class= "item" >1</div>
	<div class= "Item" >23</div>
	<div class= "item" >4</div>
	</div>

There are six properties that can be written on items:

flex-direction
Flex-wrap
Flex-flow
justify-content
Align-items
align-content

There are 6 that can be written on the item:

order//This is the item alone, and if you want the item to be reversed, give this attribute to that item.
Flex-grow
Flex-shrink
flex-basis
Flex
align-self

The above is a small series for you to bring a comprehensive understanding of the use of flex all content, I hope that we support cloud Habitat Community ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.