Introduction to Flex layout elements in css (with code)
This article brings you an introduction to the Flex layout elements in CSS (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
The flex layout is "flexible layout". Any element can be set to the css attribute display:flex; webkit kernel browser is display: -webkit-flex;
Specify the element as Flex layout .
Elements that adopt Flex layout are called "flex containers", and all their sub-elements are called Flex items;
Container properties
flex-direction
The arrangement direction selection value of the items: row (default value: left to right) | row-reverse (right to left) | column (top to bottom) | column-reverse (bottom to Top)
.box { flex-direction: row | row-reverse | column | column-reverse; }
flex-wrap
Define whether the item should be wrapped. Select the value: nowrap (default value: no line wrapping) | wrap (line wrapping, the first line is above) | reverse -wrap (line wrap, first line below)
.box{ flex-wrap: nowrap | wrap | wrap-reverse; }
flex-flow
is the abbreviation of flex-direction property and flex-wrap property. The default value is row nowrap
.box { flex-flow: <flex-direction> || <flex-wrap>; }
justify-content
Define the alignment of items on the main axis. Select the value flex-start (default left-aligned) | flex-end (right-aligned) | center (center) | space-between (aligned at both ends) | space-around (equal spacing between each item)
.box { justify-content: flex-start | flex-end | center | space-between | space-around; }
align-items
Defines how items are aligned on the cross axis. Select values flex-start (alignment of the starting point of the cross axis) | flex-end (alignment of the end point of the cross axis) | center (alignment of the midpoint of the cross axis) | baseline (baseline alignment of the first line of text of the item) | stretch (item If the height is not set or set to auto, it will occupy the entire height of the container)
.box { align-items: flex-start | flex-end | center | baseline | stretch; }
align-content
Defines the alignment of multiple axes. This property has no effect if the project has only one axis.
.box { align-content: flex-start | flex-end | center | space-between | space-around | stretch; }
Properties of items
order
.item { order: <integer>; }
flex-grow
.item { flex-grow: <number>; /* default 0 */ }
flex-shrink
.item { flex-shrink: <number>; /* default 1 */ }
flex-basis
.item { flex-basis: <length> | auto; /* default auto */ }
flex
.item { flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] }
align-self
.item { align-self: auto | flex-start | flex-end | center | baseline | stretch; }
The above is the detailed content of Introduction to Flex layout elements in css (with code). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text
