话说前端13-css的flex布局 css fixed布局
yuyutoo 2024-10-25 19:19 4 浏览 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新学苑原创,如有侵权,请联系删除。
相关推荐
- 如何在HTML中使用JavaScript:从基础到高级的全面指南!
-
“这里是云端源想IT,帮你...
- 推荐9个Github上热门的CSS开源框架
-
大家好,我是Echa。...
- 硬核!知网首篇被引过万的论文讲了啥?作者什么来头?
-
整理|袁小华近日,知网首篇被引量破万的中文论文及其作者备受关注。知网中心网站数据显示,截至2021年7月23日,由华南师范大学教授温忠麟等人发表在《心理学报》2004年05期上的学术论文“中介效应检验...
- 为什么我推荐使用JSX开发Vue3_为什么用vue不用jquery
-
在很长的一段时间中,Vue官方都以简单上手作为其推广的重点。这确实给Vue带来了非常大的用户量,尤其是最追求需求开发效率,往往不那么在意工程代码质量的国内中小企业中,Vue占据的份额极速增长...
-
- 【干货】一文详解html和css,前端开发需要哪些技术?
-
网站开发简介...
-
2025-02-20 18:34 yuyutoo
- 分享几个css实用技巧_cssli
-
本篇将介绍几个css小技巧,目录如下:自定义引用标签的符号重置所有标签样式...
- 如何在浏览器中运行 .NET_怎么用浏览器运行代码
-
概述:...
- 前端-干货分享:更牛逼的CSS管理方法-层(CSS Layers)
-
使用CSS最困难的部分之一是处理CSS的权重值,它可以决定到底哪条规则会最终被应用,尤其是如果你想在Bootstrap这样的框架中覆盖其已有样式,更加显得麻烦。不过随着CSS层的引入,这一...
-
- HTML 基础标签库_html标签基本结构
-
HTML标题HTML标题(Heading)是通过-...
-
2025-02-20 18:34 yuyutoo
- 前端css面试20道常见考题_高级前端css面试题
-
1.请解释一下CSS3的flexbox(弹性盒布局模型),以及适用场景?display:flex;在父元素设置,子元素受弹性盒影响,默认排成一行,如果超出一行,按比例压缩flex:1;子元素设置...
- vue引入外部js文件并使用_vue3 引入外部js
-
要在Vue中引入外部的JavaScript文件,可以使用以下几种方法:1.使用``标签引入外部的JavaScript文件。在Vue的HTML模板中,可以直接使用``标签来引入外部的JavaScrip...
- 网页设计得懂css的规范_html+css网页设计
-
在初级的前端工作人员,刚入职的时候,可能在学习前端技术,写代码不是否那么的规范,而在工作中,命名的规范的尤为重要,它直接与你的代码质量挂钩。网上也受很多,但比较杂乱,在加上每年的命名都会发生一变化。...
- Google在Chrome中引入HTML 5.1标记
-
虽然负责制定Web标准的WorldWideWebConsortium(W3C)尚未宣布HTML5正式推荐规格,而Google已经迁移到了HTML5.1。即将发布的Chrome38将引入H...
- HTML DOM 引用( ) 对象_html中如何引用js
-
引用对象引用对象定义了一个同内联元素的HTML引用。标签定义短的引用。元素经常在引用的内容周围添加引号。HTML文档中的每一个标签,都会创建一个引用对象。...
你 发表评论:
欢迎- 一周热门
- 最近发表
- 标签列表
-
- mybatis plus (70)
- scheduledtask (71)
- css滚动条 (60)
- java学生成绩管理系统 (59)
- 结构体数组 (69)
- databasemetadata (64)
- javastatic (68)
- jsp实用教程 (53)
- fontawesome (57)
- widget开发 (57)
- vb net教程 (62)
- hibernate 教程 (63)
- case语句 (57)
- svn连接 (74)
- directoryindex (69)
- session timeout (58)
- textbox换行 (67)
- extension_dir (64)
- linearlayout (58)
- vba高级教程 (75)
- iframe用法 (58)
- sqlparameter (59)
- trim函数 (59)
- flex布局 (63)
- contextloaderlistener (56)