rpx是微信小程序新推出的一个单位,按官方的定义,rpx可以根据屏幕宽度进行自适应,在rpx出现之前,web页面的自适应布局已经有了多种解决方案,为什么微信还捣鼓出新的rpx单位?在解释这个单位前,我们先简单了解一下目前的主流的自适应布局解决方案: 响应式(Responsive web design) rem 流式布局 scale伸缩布局 响应式 响应式布局的问题在于需要维护多个样式文件,维护成本太大,一般的移动H5页面都不会优先考虑. rem rem是近几年比较流行的方案,淘宝移动web端就是…
容器的概念,是用来包含其它容器(container)和项目(item). flex container——flex容器 A flexbox layout is defined using the flex or inline-flex values of the display property on the parent item. This element then becomes a flex container, and each one of its children becomes…
Flexbox ——弹性布局 Flexbox is a layout model for displaying items in a single dimension — as a row or as a column. 弹性布局是一种基于一维的行和列的布局模型. The key feature of flexbox is the fact that items in a flex layout can grow and shrink. 弹性布局的关键特性就是item(项)可以放大和收缩. Sp…
Flex Item flex容器的子元素就是这个容器的flex item. The direct children of a Flex Container (elements with display: flex or display: inline-flex set on them) become flex items. Continuous runs of text inside flex containers will also become flex items. flex容器里的连续文…