- 语言特性
- LESS - 嵌套规则
- LESS - 嵌套指令和冒泡
- LESS - 运算
- LESS - 转义
- LESS - 函数
- LESS - 命名空间和访问器
- LESS - 作用域
- LESS - 注释
- LESS - 导入
- LESS - 变量
- LESS - 扩展
- LESS - Mixin
- LESS - 参数化 Mixin
- LESS - Mixin 作为函数
- LESS - 向 Mixin 传递规则集
- LESS - 导入指令
- LESS - 导入选项
- LESS - Mixin 保护
- LESS - CSS 保护
- LESS - 循环
- LESS - 合并
- LESS - 父选择器
- 函数
- LESS - 其他函数
- LESS - 字符串函数
- LESS - 列表函数
- LESS - 数学函数
- LESS - 类型函数
- LESS - 颜色定义函数
- LESS - 颜色通道函数
- LESS - 颜色运算
- LESS - 颜色混合函数
- 用法
- LESS - 命令行用法
- 在浏览器中使用 LESS
- LESS - 浏览器支持
- LESS - 插件
- LESS - 编程方式使用
- LESS - 在线编译器
- LESS - 图形用户界面
- LESS - 编辑器和插件
- LESS - 第三方编译器
- LESS - 框架
- LESS 有用资源
- LESS - 快速指南
- LESS - 有用资源
- LESS - 讨论
LESS - 颜色混合屏幕函数
描述
screen 函数接受两种颜色作为参数,并生成更亮的输出颜色。
参数
color1 − 颜色对象。
color2 − 颜色对象。
返回值
颜色
示例
以下示例演示了在 LESS 文件中使用 screen 函数:
<html>
<head>
<link rel = "stylesheet" href = "style.css" type = "text/css" />
</head>
<body>
<h2>Screen Function</h2>
<div class = "color1">
<p>(color1) <br> #ff6600</p>
</div><br>
<div class = "color2">
<p>(color2) <br> #0000ff</p>
</div><br>
<div class = "res">
<p>(result) <br> #ff66ff</p>
</div>
</body>
</html>
接下来,创建 style.less 文件。
style.less
.color1 {
width: 100px;
height: 100px;
background-color: #ff6600;
}
.color2 {
width: 100px;
height: 100px;
background-color: #0000ff;
}
.res {
width: 100px;
height: 100px;
background-color: screen(#ff6600, #0000ff);
}
p {
padding: 30px 0px 0px 25px;
}
您可以使用以下命令将 style.less 编译为 style.css:
lessc style.less style.css
执行上述命令;它将自动创建包含以下代码的 style.css 文件:
style.css
.color1 {
width: 100px;
height: 100px;
background-color: #ff6600;
}
.color2 {
width: 100px;
height: 100px;
background-color: #0000ff;
}
.result {
width: 100px;
height: 100px;
background-color: #ff66ff;
}
p {
padding: 30px 0px 0px 25px;
}
输出
请按照以下步骤查看以上代码的工作方式:
将以上代码保存到 color_blending_screen.html 文件中。
在浏览器中打开此 HTML 文件,将显示以下输出。
less_color_blending_functions.htm
广告