当前位置:网站首页>REM layout
REM layout
2022-07-16 05:37:00 【Miss Vivian】
rem Layout
List of articles
One 、rem Basics
1.em Is relative to Parent element Of font size
2.rem Is relative to html Elements Of font size
rem The advantages of : It can be modified by html The overall size of page elements is controlled by the text size inside
Two 、 Media query


mediatype:all( All devices )、print( Printer and print preview )、screen( Computer screen , Flat , mobile phone )
keyword :and( And )、not( Not )、only( Specify the media type of a certain type , It can be omitted )
Media features :width、min-width、max-width
/* On screen also The biggest width is 300 Pixels Set the style you want */
/* From small to large */
@media screen and (max-width: 300px) {
}
@media screen and (min-width: 301px) {
}
@media screen and (min-width: 501px) {
}
Media queries can be written from small to large or from large to small , But use From small to large It will be more concise (css Layering )
3、 ... and 、Less Basics


(1)less Variable 
@color: pink;
body {
background-color: @color;
}
(2)less compile 
(3)less nesting
.nav {
width: 200px;
height: 200px;
background-color: pink; // Descendant selector .logo {
color: red;
}
a {
// Pseudo class selector &:hover {
color: blue;
}
// Pseudo element selector &::before {
content: "";
}
}
}
&: pseudo-classes 、 Pseudo elements 、 Intersection selector
(4)less operation
less Provided with the addition of (+) reduce (-) ride (*) except (/) Arithmetic
Operator There must be spaces on the left and right
Two numbers are involved in the operation , If only one number has units , The final result is based on this unit
Both numbers have units , And the two units are different , Subject to the first unit
@border: 5px + 5;
div {
width: 200px - 50;
height: 200px * 2;
border: @border solid red;
}
img {
width: 82 / 50rem;
height: 82 / 50rem;
}
Four 、rem Adaptation scheme
Method : Use media query to set up proportionally according to different devices html Font size of , Then page elements use rem Make the unit of measurement , When html When the font size changes , The element size will also change , So as to achieve the matching of proportional scaling .

Technical proposal 1 :less + Media query + rem


Example : Suning homepage production
Static website : Home page of Suning mobile terminal 1
Technical proposal II :flexible.js + rem
Note that it is divided into 10 Equal parts
边栏推荐
猜你喜欢

41.js--闭包
![[tensorflow2] implementation of gradient inversion layer (GRL) and domain antagonism training neural network (Dann)](/img/c4/1e1d68a69cb41da8ebb6463a35ca82.png)
[tensorflow2] implementation of gradient inversion layer (GRL) and domain antagonism training neural network (Dann)

【黄啊码】今天居然有人问我:where 1=1 是什么意思?

ES6新增的变量修饰符let和const、新增的基本数据类型symbol

【黄啊码】微软IE浏览器将退役 网友说:以后考试报名咋办?

Windows system disk slimming (Development)

sql_ Server2014 download and installation

38.js--原型练习案例(校招面试题)

<statement> or DELIMITER expected, got ‘id‘

36.js--原型链2--(笔试题为主)
随机推荐
北游项目笔记
: class modify style
[Huang ah code] getting started with MySQL - 1. SQL execution process
JS作用域链
rem布局
ES6--Set
树数据中根据子节点id查找父节点的id
ramda. JS API quick check
[Huang ah code] getting started with MySQL - 2. Using data definition language (DDL) to operate the database
Automated machine learning
【黄啊码】为什么我建议您选择go,而不选择php?
ES6新增的变量修饰符let和const、新增的基本数据类型symbol
<statement> or DELIMITER expected, got ‘id‘
[Huang ah code] PHP cooperates with wechat official account to generate promotion QR code
2.内存泄漏与内存溢出
window系统盘瘦身(开发)
Svelte official introductory tutorial (1) - Introduction
Oracle数据库 错误代码解决办法
C语言:通过结构体实现通讯录的简易功能
Svelte official introductory tutorial (2) - reactivity