当前位置:网站首页>长度以及颜色单位基本概念
长度以及颜色单位基本概念
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代表透明度)
边栏推荐
- LeetCode中常用语言的一些基本方法记录
- VS Code私有服务器部署(私有化)
- Late night drinking, 50 classic SQL questions, really fragrant~
- 设置文本向两边居中展示
- NACOS Configuration Center Settings Profile
- config.js related configuration summary
- Error correction notes for the book Image Processing, Analysis and Machine Vision
- The size of the screen adaptation
- 如何将.asd恢复为Word文档
- One-arm routing experiment and three-layer switch experiment
猜你喜欢
![[issue resolved] - jenkins pipeline checkout timeout](/img/3d/c14276d2b5ce18fc3d1288abb059c0.png)
[issue resolved] - jenkins pipeline checkout timeout

Late night drinking, 50 classic SQL questions, really fragrant~

LeetCode练习及自己理解记录(1)

前置++和后置++的区别
![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]

淘宝客APP带自营商城本地生活CPS外卖优惠电影票话费更新渠道跟单生活特权V3

多行文本省略

One-arm routing experiment and three-layer switch experiment

滚动条问题,未解决

深夜小酌,50道经典SQL题,真香~
随机推荐
滚动条问题,未解决
cs231n learning record
lingo入门——河北省第三届研究生建模竞赛B题
scikit-image图像处理笔记
D45_Camera assembly Camera
花花省V5淘宝客APP源码无加密社交电商自营商城系统带抖音接口
Browser Storage for H5
In-depth analysis if according to data authority @datascope (annotation + AOP + dynamic sql splicing) [step by step, with analysis process]
H5 的浏览器存储
自营商城提高用户留存小技巧,商城对接小游戏分享
What is the website ICP record?
单片机原理与应用复习
Programmers should understand I/O this way
ES2020新特性
【FAQ】What is Canon CCAPI
Difference between link and @improt
Successful indie developers deal with failure & imposters
亚马逊美国站:马术头盔CPC认证标准要求
[issue resolved] - jenkins pipeline checkout timeout
浏览器兼容汇总