This time I will bring you a detailed explanation of the layout of the display attribute in CSS3. What are the precautions for the layout of the display attribute in CSS3? The following is a practical case, let's take a look.
Recently I am learning WeChat applet. When designing the layout of the homepage, I came across a new layout method display:flex.container { display: flex; flex-direction: column; align-items: center; background-color: #b3d4db; }The effect after compilation is very obvious, and the layout of the interface is also very reasonable. , looks very clear. So what is this attribute used for? Flex is the abbreviation of Flexible Box, which means "flexible layout" and is used to provide maximum flexibility for box-shaped models. After setting to Flex layout, the float, clear and
vertical-align attributes of child elements will be invalid.
It can be applied to containers or inline elements. (The above description is combined with the WeChat developer tool description) In 2009, W3C proposed a new solution - Flex layout, which can implement various Elements that adopt Flex layout are called Flex containers (flex containers), or "containers" for short. All its child elements automatically become container members, called Flex items (flex items), referred to as "items". The container has two axes by default: the horizontal main axis and the vertical cross axis. The starting position of the main axis (the intersection with the border) is called main start, and the ending position is called main end; the starting position of the cross axis is called cross start, and the ending position is called cross end. Items are arranged along the main axis by default. The main axis space occupied by a single item is called main size, and the cross axis space occupied by a single item is called cross size.- flex-direction The arrangement direction of the items in the container (default horizontal arrangement)
- flex-wrap The wrapping method of items in the container
- flex-flow The abbreviation of the above two properties
- justify-content How items are aligned on the main axis
- align-items How items are aligned on the cross axis
- align- content Defines the alignment of multiple axes. This property has no effect if the project has only one axis.
flex-direction
.box { 2 flex-direction: row | row-reverse | column | column-reverse; 3 }The optional value range of the attribute is row (default) arranged from left to right along the horizontal main axis, row- reverse is arranged from right to left along the horizontal main axis, column is arranged from top to bottom along the vertical main axis, and column-reverse.
flex-wrap
.box{ 2 flex-wrap: nowrap | wrap | wrap-reverse; 3 }The optional value range of the attribute is nowrap (default) without wrapping, wrap wrapping (the first line is above) and wrap-reverse ( You know~)
flex-flow
.box { 2 flex-flow: <flex-direction> || <flex-wrap>; 3 }</flex-wrap></flex-direction>In the writing attribute, just connect the values of the above two methods with ||
justify-content
.box { 2 justify-content: flex-start | flex-end | center | space-between | space-around; 3 }The alignment of the item on the main axis (which axis the main axis is depends on the setting of the property flex-direction)flex-start: in Arrange from left or top on the main axisflex-end: Arrange from right or bottom on the main axiscenter: Arrange in the center on the main axisspace-between: Arrange starting from the left and right ends or the upper and lower ends on the main axis space-around: The intervals on both sides of each item are equal. Therefore, the space between items is twice as large as the space between items and the border.
align-items
.box { 2 align-items: flex-start | flex-end | center | baseline | stretch; 3 }The pictures directly explain it more clearly
align-content
.box { 2 align-content: flex-start | flex-end | center | space-between | space-around | stretch; 3 }
order 项目的排列顺序。数值越小,排列越靠前,默认为0。
flex-grow 项目的放大比例,默认为0,即如果存在剩余空间,也不放大。
flex-shrink 项目的缩小比例,默认为1,即如果空间不足,该项目将缩小。
flex-basis 在分配多余空间之前,项目占据的主轴空间(main size)。浏览器根据这个属性,计算主轴是否有多余空间。它的默认值为auto,即项目的本来大小。
flex 是flex-grow, flex-shrink 和 flex-basis的简写,默认值为0 1 auto。后两个属性可选。
align-self 允许单个项目有与其他项目不一样的对齐方式,可覆盖align-items属性。默认值为auto,表示继承父元素的align-items属性,如果没有父元素,则等同于stretch。
order
.item { order: <integer>; }</integer>
flex-grow
.item { flex-grow: <number>; /* default 0 */ }</number>
flex-shrink
.item { flex-shrink: <number>; /* default 1 */ }</number>
flex-basis
.item { flex-basis: <length> | auto; /* default auto */ }</length>
flex
.item { flex: none | [ ? || ] }
align-self
.item { align-self: auto | flex-start | flex-end | center | baseline | stretch; }
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
The above is the detailed content of Detailed explanation of display attribute layout in CSS3. For more information, please follow other related articles on the PHP Chinese website!

三星智能显示器M8与AppleStudio显示器:设计和尺寸自推出以来,AppleStudioDisplay就被比作iMac,由相对简单的L形支架上的相对薄的面板组成。这是一种众所周知且深受喜爱的美学,三星似乎借用了它的展示。三星SmartMonitorM8采用了与外观非常相似的支架上的薄屏幕的相同想法。一些次要元素有所不同,例如左下角的小部分有点突出,三星的下巴很薄,但它们在基本设计方面似乎很接近。三星似乎从24英寸iMac中获得了很多灵感。苹果的显示器比三星的要小

AppleStudioDisplay现已在商店正式发售,全球已有多家客户购买了该产品。与ProDisplayXDR不同,StudioDisplay有一个独特的电源连接器,似乎是不可拆卸的。事实证明,电缆是可拆卸的,但您需要使用特殊工具才能将其卸下。苹果在其网站上表示,StudioDisplay的电源线是不可拆卸的——而且很多用户都这么认为。那是因为用你的双手移除电缆似乎是不可能的,但幸运的是,电缆可以从显示器上分离。,Apple有一个特殊的工具,用于从其新的StudioDispl

StudioDisplay和LGUltraFine5KDisplay在市场上占有相似的位置,但苹果的显示器要贵300美元。以下是您需要了解的有关这些显示器如何比较的所有信息。六年在科技领域是一段很长的时间,而这也是苹果出售一款价格不超过5,000美元的品牌显示器以来的时间。在此期间,Apple与LG合作销售专门迎合Mac用户的LGUltraFine系列。2019年,Apple停止销售这些LG显示器,转而支持ProDisplayXDR,这在价格适中的Mac友好显

display通常指的是将数据、信息或结果以某种方式展示给用户或输出到屏幕或其他设备上的操作或功能。具体含义:1、在命令行界面(CLI)中,display可能指的是将文本、表格或其他格式的数据输出到终端窗口,供用户查看或分析;2、在图形用户界面(GUI)中,display可能指的是将图像、文本、图表等内容显示在应用程序的窗口或界面上,以供用户交互或浏览等等。

在Mac上运行Windows的IntelMac用户现在可以更新BootCamp中的驱动程序,以支持Apple的StudioDisplay。Apple会定期更新BootCamp,以引入对新硬件的支持,以及典型的兼容性和性能改进。在3月份的软件更新中,Apple已启用BootCamp以与新的StudioDisplay配合使用。将BootCamp带到6.1.17版的更新引入了两个关键支持元素。首先,它增加了对StudioDisplay的兼容性,确

display的取值有block、inline、none、inline-block、flex、grid、table、inline-table和list-item等。详细介绍:1、block,将元素渲染为块级元素,块级元素在页面上形成一个块,并且独占一行;2、inline,将元素渲染为内联元素。内联元素不会独占一行,可以与其他元素并排;3、none,此值指定元素不会在页面上等等。

Apple本周发布了StudioDisplay,它采用27英寸5K面板,结合了摄像头、麦克风和扬声器,当用户将显示器连接到Mac时,它们可以协同工作。窗户呢?如果出于某种原因您需要在WindowsPC上使用Apple的1599美元显示器,您可以,但有一些限制。当通过Thunderbolt连接(并非每台PC都支持)插入WindowsPC时,StudioDisplay被识别为常规显示器。也就是说,如果您购买了其中一个以将其与Windows一起使用,则需要记

Apple在本周早些时候的PeekPerformance活动中展示了StudioDisplay。该显示器具有典型显示器通常不具备的非凡规格。对于不熟悉的人,StudioDisplay配备前置摄像头、扬声器、USBType-C端口、工作室品质的麦克风阵列和Apple的A13仿生芯片。然而,许多用户不知道的是,AppleStudioDisplay也有一个重大缺陷。那些不注意特定细节的人可能会在以后后悔他们昂贵的购买。这家库比蒂诺科技巨头正在销售StudioDisplay,


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft