百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程网 > 正文

话说前端13-css的flex布局 css fixed布局

yuyutoo 2024-10-25 19:19 10 浏览 0 评论

分享兴趣,传播快乐,增长见闻,留下美好!

亲爱的您,这里是LearningYard学苑。

今天小编为大家带来

话说前端-13-css的flex布局

欢迎您的访问。

Share interests, spread happiness, increase knowledge, and leave a good legacy!


Dear you, this is The LearningYard Academy.


Today Xiaobian brings it to you


Welcome to your visit.


今天我们讲一讲css中比较重要的布局之一,flex布局。

通常我们给flex布局是给父元素的,通过display:flex进行设置。通常要给父元素明确的宽高。

Today, let's talk about one of the more important layouts in css, flex layout.

Usually, the layout we give to flex is for the parent element, which is set by display:flex. Usually, the parent element should be given a clear width and height.


flex布局还有一些其他的属性,也是给父元素的,通过把其存在的空白空间各种分配来达到一种布局的目的。首先伸展,即给子元素设置宽高后,剩余的空间直接通过比例来分配空间。属性为flex-grow:默认为0,如:0 1 2,就是按0:1:2分配剩余空间。同理还有flex-shrink。

The layout of flex has some other attributes, which are also given to the parent elements, and the purpose of a layout is achieved by allocating all kinds of empty spaces in it. First, after stretching, that is, setting the width and height of sub-elements, the remaining space is allocated directly by proportion. The attribute flex-grow: defaults to 0, such as 0 1 2, which means that the remaining space is allocated according to 0: 1: 2. Similarly, there is flex-shrink.

还有flex-decotion:设置主轴的排列方式,如row,从左向右,以及row-revese,就是反向,还有column,从上到下,以及column的反向column-reserve。

There is also flex-decotion: set the arrangement of spindles, such as row, from left to right, and row-revese, which is reverse, and column, from top to bottom, and the reverse column-reserve of Column.

还有justify-content:分配剩余的空间

flex-star-----元素沿着主轴起点排列(默认值)

flex-end-----元素沿着终点排列

center-------元素剧中排列

space-around----空白分布到元素两侧

space-between---空白均匀分布到元素之间

space-evenly----空白分布到元素的单侧。

And justify-content: allocate the remaining space.

Flex-star-elements are arranged along the starting point of the main axis (default value)

Flex-end-elements are arranged along the end point.

Center------- element arrangement in the play

Space-around---- white space is distributed on both sides of the element.

Space-between--- white space is evenly distributed among elements.

Space-even-white space is distributed to one side of the element.


同时还有align-content:分配辅轴空间

center----元素在中间,上下空间分布一样。

flex-start----元素在上边,空间分布在下边

flex-end---元素分布在下面,空白分布在上面

space-around----空白分布在两边。

space-between---空白分布在元素的中间

At the same time, align-content: allocate secondary axis space.

Center---- the elements are in the middle, and the upper and lower spaces are equally distributed.

Flex-start---- the elements are on the top and the space is distributed on the bottom.

Flex-end--- elements are distributed below, and blanks are distributed above.

Space-around---- blank spaces are distributed on both sides.

Space-between--- white space is distributed in the middle of elements.


以上的元素都是通过父元素来影响子元素,但有些固定,后面我们会讲一讲更加实用更加强大的grid布局。

All the above elements affect the children through the parent elements, but some of them are fixed. Later, we will talk about the more practical and powerful grid layout.

翻译源自Google翻译

本文由learningyard新学苑原创,如有侵权,请联系删除。

相关推荐

墨尔本一华裔男子与亚裔男子分别失踪数日 警方寻人

中新网5月15日电据澳洲新快网报道,据澳大利亚维州警察局网站消息,22岁的华裔男子邓跃(Yue‘Peter’Deng,音译)失踪已6天,维州警方于当地时间13日发布寻人通告,寻求公众协助寻找邓跃。华...

网络交友须谨慎!美国犹他州一男子因涉嫌杀害女网友被捕

伊森·洪克斯克(图源网络,侵删)据美国广播公司(ABC)25日报道,美国犹他州一名男子于24日因涉嫌谋杀被捕。警方表示,这名男子主动告知警局,称其杀害了一名在网络交友软件上认识的25岁女子。雷顿警...

一课译词:来龙去脉(来龙去脉 的意思解释)

Mountainranges[Photo/SIPA]“来龙去脉”,汉语成语,本指山脉的走势和去向,现比喻一件事的前因后果(causeandeffectofanevent),可以翻译为“i...

高考重要考点:range(range高考用法)

range可以用作动词,也可以用作名词,含义特别多,在阅读理解中出现的频率很高,还经常作为完形填空的选项,而且在作文中使用是非常好的高级词汇。...

C++20 Ranges:现代范围操作(现代c++白皮书)

1.引言:C++20Ranges库简介C++20引入的Ranges库是C++标准库的重要更新,旨在提供更现代化、表达力更强的方式来处理数据序列(范围,range)。Ranges库基于...

学习VBA,报表做到飞 第二章 数组 2.4 Filter函数

第二章数组2.4Filter函数Filter函数功能与autofilter函数类似,它对一个一维数组进行筛选,返回一个从0开始的数组。...

VBA学习笔记:数组:数组相关函数—Split,Join

Split拆分字符串函数,语法Split(expression,字符,Limit,compare),第1参数为必写,后面3个参数都是可选项。Expression为需要拆分的数据,“字符”就是以哪个字...

VBA如何自定义序列,学会这些方法,让你工作更轻松

No.1在Excel中,自定义序列是一种快速填表机制,如何有效地利用这个方法,可以大大增加工作效率。通常在操作工作表的时候,可能会输入一些很有序的序列,如果一一录入就显得十分笨拙。Excel给出了一种...

Excel VBA入门教程1.3 数组基础(vba数组详解)

1.3数组使用数组和对象时,也要声明,这里说下数组的声明:'确定范围的数组,可以存储b-a+1个数,a、b为整数Dim数组名称(aTob)As数据类型Dimarr...

远程网络调试工具百宝箱-MobaXterm

MobaXterm是一个功能强大的远程网络工具百宝箱,它将所有重要的远程网络工具(SSH、Telnet、X11、RDP、VNC、FTP、MOSH、Serial等)和Unix命令(bash、ls、cat...

AREX:携程新一代自动化回归测试工具的设计与实现

一、背景随着携程机票BU业务规模的不断提高,业务系统日趋复杂,各种问题和挑战也随之而来。对于研发测试团队,面临着各种效能困境,包括业务复杂度高、数据构造工作量大、回归测试全量回归、沟通成本高、测试用例...

Windows、Android、IOS、Web自动化工具选择策略

Windows平台中应用UI自动化测试解决方案AutoIT是开源工具,该工具识别windows的标准控件效果不错,但是当它遇到应用中非标准控件定义的UI元素时往往就无能为力了,这个时候选择silkte...

python自动化工具:pywinauto(python快速上手 自动化)

简介Pywinauto是完全由Python构建的一个模块,可以用于自动化Windows上的GUI应用程序。同时,它支持鼠标、键盘操作,在元素控件树较复杂的界面,可以辅助我们完成自动化操作。我在...

时下最火的 Airtest 如何测试手机 APP?

引言Airtest是网易出品的一款基于图像识别的自动化测试工具,主要应用在手机APP和游戏的测试。一旦使用了这个工具进行APP的自动化,你就会发现自动化测试原来是如此简单!!连接手机要进行...

【推荐】7个最强Appium替代工具,移动App自动化测试必备!

在移动应用开发日益火爆的今天,自动化测试成为了确保应用质量和用户体验的关键环节。Appium作为一款广泛应用的移动应用自动化测试工具,为测试人员所熟知。然而,在不同的测试场景和需求下,还有许多其他优...

取消回复欢迎 发表评论: