当前位置:网站首页>长度以及颜色单位基本概念
长度以及颜色单位基本概念
2022-08-05 05:25:00 【Y-琼眸】
长度单位
1.像素 px
像素就是屏幕上的一个个小点,这小点正常情况看不到,放大到一定的倍数才能看到,一个小点就是1px。
物理像素:一开始开发商就设定好了,在pc端1px=一个物理像素
这也是我们最常用的单位,固定单位
2.百分比 %
相对其父元素的宽高进行设置的,是一个相对单位,多用于流体式布局
3.em
相对于当前字体大小(例如字体20px 5em=100px)如果不设置字体大小,字体默认16px
如果当前元素没有设置字体大小,则它会继承祖先元素的字体大小,直到继承根标签的字体大小(跟标签字体大小默认16px)
4.rem
r=根(root) 只相对于根标签的字体大小进行设置的
注意:相对单位一般多用于移动端布局
颜色单位
1.在css中可以直接用颜色单词表示不同颜色
但这种用法比较少,因为颜色单词太多,而且不好描述
2.使用RGB值来表示不同颜色
RGB(red,green,blue)
通过红绿蓝不同的颜色浓度调配出一种颜色
通过0-255之间的数值进行调皮
0 最小
255 最大
3.RGBA
a 表示透明度,数值为0-1,0是完全透明,1代表完全不透明
4.使用十六进制的rgb值来表示颜色,原理上和RGB一样
十六进制 0-9abcdef
通过十六进制分别表示红色,绿色,蓝色
语法:#+十六进制
如果十六进制是 #00ff00 这样的(两两重复)则可以写成 #0f0 简写
常用的:#fff白色 #000黑色 #f00红色 #0f0绿色 #f60橘色 #ccc灰色
5.HSL值 HSLA值
hsl 分别表示亮度,色相,颜色 (a代表透明度)
边栏推荐
猜你喜欢

DevOps流程demo(实操记录)

DevOps process demo (practical record)

Configuration of routers and static routes

VLAN is introduced with the experiment

LeetCode中常用语言的一些基本方法记录
![In-depth analysis if according to data authority @datascope (annotation + AOP + dynamic sql splicing) [step by step, with analysis process]](/img/b5/03f55bb9058c08a48eae368233376c.png)
In-depth analysis if according to data authority @datascope (annotation + AOP + dynamic sql splicing) [step by step, with analysis process]

Autoware--Beike Tianhui rfans lidar uses the camera & lidar joint calibration file to verify the fusion effect of point cloud images

设置文本向两边居中展示

【FAQ】CCAPI Compatible EOS Camera List (Updated in August 2022)

scikit-image图像处理笔记
随机推荐
docker部署完mysql无法连接
GetEnumerator method and MoveNext and Reset methods in Unity
UI刘海屏适配方式
盒子模型中过度约束问题及其解决办法
Cloud Computing Basics - Study Notes
数组&的运算
input详解之文件上传
Does flink cdc currently support Gauss database sources?
uniapp打包次数限制怎么办?只需两步就能解决
七种让盒子水平垂直居中的方法
The size of the screen adaptation
滚动条问题,未解决
Collision, character controller, Cloth components (cloth), joints in the Unity physics engine
System basics - study notes (some command records)
el-autocomplete使用
Dry!Teach you to use industrial raspberries pie combining CODESYS configuration EtherCAT master station
邮件管理 过滤邮件
单片机期末复习大题
el-progress implements different colors of the progress bar
The hook of the operation of the selenium module