html - 菜单按钮(位置:固定)可见性问题
问题描述
我对菜单按钮(位置:固定)颜色有疑问。我想让按钮文本颜色与背景相反,但找不到解决方案。
body {
margin: 0;
}
.content {
height: 100px;
background-color: #0b1433;
}
.content:nth-child(2n) {
background-color: #fff;
}
.menu {
position: fixed;
font-weight: 600;
font-size: 24px;
right: 1vw;
top: 40%;
writing-mode: tb-rl;
border-right: 6px double #000;
}
<div class="main">
<div class="menu">
<span>MENU</span>
</div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
</div>
解决方案
将您的样式更改.menu
为此。
.menu {
position: fixed;
font-weight: 600;
font-size: 24px;
right: 1vw;
top: 40%;
writing-mode: tb-rl;
border-right: 6px double #000;
mix-blend-mode: difference; /* This will change the color */
color: rgb(255, 255, 255); /* Needs to be white if you want black text */
}
最后两个属性将为您提供所需的效果。
它会将菜单的颜色更改为与其下方背景相反的颜色。
推荐阅读
- python - 将具有混合字符串的列转换为纪元日期熊猫数据框
- arrays - Excel VBA - 有条件地将输入添加到数组以进行分析
- octobercms - 如何在 octobercms 上拥有相同插件的 2 个实例
- node.js - 快递:OpenSSL 错误:_tls_common.js:129 c.context.setCert(cert);
- c++ - 对象参数内的对象初始化(构造函数)
- python - 如何从包含启动和完成条目时间的重新启动列中的前几行计算启动时间 - (Python)
- python - 名称 Bot 未在 cicle 中定义,而
- facebook - 从发布帖子的其他用户那里获取 FACEBOOK 帖子
- vector - 向量生成的词分布
- c# - 具有泛型类型和泛型列表的类