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

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

yuyutoo 2024-10-25 19:19 6 浏览 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新学苑原创,如有侵权,请联系删除。

相关推荐

Mysql和Oracle实现序列自增(oracle创建序列的sql)

Mysql和Oracle实现序列自增/*ORACLE设置自增序列oracle本身不支持如mysql的AUTO_INCREMENT自增方式,我们可以用序列加触发器的形式实现,假如有一个表T_WORKM...

关于Oracle数据库12c 新特性总结(oracle数据库19c与12c)

概述今天主要简单介绍一下Oracle12c的一些新特性,仅供参考。参考:http://docs.oracle.com/database/121/NEWFT/chapter12102.htm#NEWFT...

MySQL CREATE TABLE 简单设计模板交流

推荐用MySQL8.0(2018/4/19发布,开发者说同比5.7快2倍)或同类型以上版本....

mysql学习9:创建数据库(mysql5.5创建数据库)

前言:我也是在学习过程中,不对的地方请谅解showdatabases;#查看数据库表createdatabasename...

MySQL面试题-CREATE TABLE AS 与CREATE TABLE LIKE的区别

执行"CREATETABLE新表ASSELECT*FROM原表;"后,新表与原表的字段一致,但主键、索引不会复制到新表,会把原表的表记录复制到新表。...

Nike Dunk High Volt 和 Bright Spruce 预计将于 12 月推出

在街上看到的PandaDunk的超载可能让一些球鞋迷们望而却步,但Dunk的浪潮仍然强劲,看不到尽头。我们看到的很多版本都是为女性和儿童制作的,这种新配色为后者引入了一种令人耳目一新的新选择,而...

美国多功能舰载雷达及美国海军舰载多功能雷达系统技术介绍

多功能雷达AN/SPY-1的特性和技术能力,该雷达已经在美国海军服役了30多年,其修改-AN/SPY-1A、AN/SPY-1B(V)、AN/SPY-1D、AN/SPY-1D(V),以及雷神...

汽车音响怎么玩,安装技术知识(汽车音响怎么玩,安装技术知识视频)

全面分析汽车音响使用或安装技术常识一:主机是大多数人最熟习的音响器材,有关主机的各种性能及规格,也是耳熟能详的事,以下是一些在使用或安装时,比较需要注意的事项:LOUDNESS:几年前的主机,此按...

【推荐】ProAc Response系列扬声器逐个看

有考牌(公认好声音)扬声器之称ProAcTablette小音箱,相信不少音响发烧友都曾经,或者现在依然持有,正当大家逐渐掌握Tablette的摆位设定与器材配搭之后,下一步就会考虑升级至表现更全...

#本站首晒# 漂洋过海来看你 — BLACK&DECKER 百得 BDH2000L无绳吸尘器 开箱

作者:初吻给了烟sco混迹张大妈时日不短了,手没少剁。家里有了汪星人,吸尘器使用频率相当高,偶尔零星打扫用卧式的实在麻烦(汪星人:你这分明是找借口,我掉毛是满屋子都有,铲屎君都是用卧式满屋子吸的,你...

专题|一个品牌一件产品(英国篇)之Quested(罗杰之声)

Quested(罗杰之声)代表产品:Q212FS品牌介绍Quested(罗杰之声)是录音监听领域的传奇品牌,由英国录音师RogerQuested于1985年创立。在成立Quested之前,Roger...

常用半导体中英对照表(建议收藏)(半导体英文术语)

作为一个源自国外的技术,半导体产业涉及许多英文术语。加之从业者很多都有海外经历或习惯于用英文表达相关技术和工艺节点,这就导致许多英文术语翻译成中文后,仍有不少人照应不上或不知如何翻译。为此,我们整理了...

Fyne Audio F502SP 2.5音路低音反射式落地音箱评测

FyneAudio的F500系列,有新成员了!不过,新成员不是新的款式,却是根据原有款式提出特别版。特别版产品在原有型号后标注了SP字样,意思是SpecialProduction。Fyne一共推出...

有哪些免费的内存数据库(In-Memory Database)

以下是一些常见的免费的内存数据库:1.Redis:Redis是一个开源的内存数据库,它支持多种数据结构,如字符串、哈希表、列表、集合和有序集合。Redis提供了快速的读写操作,并且支持持久化数据到磁...

RazorSQL Mac版(SQL数据库查询工具)

RazorSQLMac特别版是一款看似简单实则功能非常出色的SQL数据库查询、编辑、浏览和管理工具。RazorSQLformac特别版可以帮你管理多个数据库,支持主流的30多种数据库,包括Ca...

取消回复欢迎 发表评论: