胡学乱想----前端知识点(css色彩)

1. margin 属性

简写 margin 属性有两个值时,它将 margin-top 和 margin-bottom 设置为第一个值,并将 margin-left 和 margin-right 设置为第二个值

handlebars 复制代码
.marker {
  width: 200px;
  height: 25px;
  background-color: red;
  margin: 10px  auto;
}
2. rgb 属性

CSS 的 rgb 函数接收红色、绿色和蓝色的数值或 arguments(参数),并生成一个颜色。

rgb(red, green, blue);

每个红色、绿色和蓝色值都是一个从 0 到 255 的数字。 0 表示该颜色的 0%,并且是黑色,255 意味着该颜色的 100%。

handlebars 复制代码
.two {
  background-color: rgb(0,255,0);
}
  • 黄色
handlebars 复制代码
background-color: rgb(255, 255, 0);
  • 间色:

淡蓝

handlebars 复制代码
 background-color: rgb(0, 255, 255);

粉色

handlebars 复制代码
 background-color: rgb(255, 0, 255);
  • 复色:

橙色

handlebars 复制代码
 background-color: rgb(255, 127, 0);

亮绿色

handlebars 复制代码
background-color: rgb(0, 255, 127);

蓝紫色

handlebars 复制代码
background-color: rgb(127, 0, 255);

黄绿色

handlebars 复制代码
background-color: rgb(127, 255, 0);

天蓝色

handlebars 复制代码
 background-color: rgb(0, 127, 255);

玫瑰色(亮粉红色)

handlebars 复制代码
background-color: rgb(255, 0, 127);
  • 十六进制颜色值
    以 # 字符开头,从 0-9 和 A-F 取六个字符。 第一对字符代表红色,第二对代表绿色,第三对代表蓝色。 例如,#4B5320
handlebars 复制代码
.green {
  background-color: #00FF00;
}
  • HSL 颜色模型
    色调、饱和度和亮度是表示颜色的另一种方式,CSS hsl 函数接受 3 个值:0 到 360 的数字表示色调,0 到 100 的百分比表示饱和度,0 到 100 的百分比表示亮度
  • 色调红色是 0 度,绿色是 120 度,蓝色是 240 度
  • 饱和度指纯色的颜色强度从 0% 或灰色到 100%。 你必须给饱和度和亮度值添加百分比标志 %
  • 亮度是颜色出现的亮度,从 0% 或全黑到 100% 或全白,其中 50% 为中性
handlebars 复制代码
.blue {
  background-color: hsl(240,100%,50%);
}
3.padding属性

也支持margin 属性类似操作, padding 属性添加上下 padding为第一个值,并将左右 padding 为第二个值

handlebars 复制代码
.container {
   padding: 10px  0;
  background-color: rgb(0, 0, 0);
}
相关推荐
Hilaku6 小时前
Event Loop 这篇你看完就不用再看别的了!
前端·javascript·程序员
恋猫de小郭7 小时前
Flutter 下 AOT 一个你怎么都想不出来的 Bug ,JIT 正常的计算,在 AOT 居然算错了
android·前端·flutter
晓得迷路了7 小时前
栗子前端技术周刊第 153 期 - Vitest 5.1、Remix v3.2、Node.js 27 Alpha...
前端·javascript·vite
Moment7 小时前
Harness Engineering 为什么是 AI Coding 的工程底座 ❓❓❓
前端·后端·面试
风骏时光牛马8 小时前
生成一个AI面试复盘标题,只需要一个标题,不需要其他的任何文本。
前端
红尘散仙17 小时前
谁说终端只能敲键盘?我用 Rust 给小说阅读器加上了鼠标
前端·后端·rust
陈随易18 小时前
C++26 草案被否,二十八年来头一回
前端·后端·程序员
ZhengEnCi18 小时前
Agent 工具怎么折叠海量输出才「爽」:Trae、Claude Code 的渐进式披露设计原理
前端·agent
IT_陈寒21 小时前
Redis内存暴涨,没想到是AOF重写捣的鬼
前端·人工智能·后端