当前位置:网站首页>长度以及颜色单位基本概念
长度以及颜色单位基本概念
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代表透明度)
边栏推荐
猜你喜欢
随机推荐
Email management Filter emails
Writing OpenCV in VSCode
Q 2020, the latest senior interview Laya soul, do you know?
May I ask how to read the binlog of the two tables of hologres through flink sql, and then how to join?
多线程之传递参数
The hook of the operation of the selenium module
数组&的运算
滚动条问题,未解决
Alibaba Cloud Video on Demand
DevOps - Understanding Learning
D46_Force applied to rigid body
Seven Ways to Center a Box Horizontally and Vertically
摆脱极域软件的限制
Wireshark packet capture and common filtering methods
【FAQ】CCAPI Compatible EOS Camera List (Updated in August 2022)
Met with the browser page
D39_ coordinate transformation
Detailed explanation of the construction process of Nacos cluster
LaTeX image captioning text column automatic line wrapping
numpy.random使用文档