gpt4 book ai didi

html - 比混合混合模式更好的选择?

转载 作者:行者123 更新时间:2023-11-28 14:21:43 26 4
gpt4 key购买 nike

我的主页有两种背景颜色。我希望导航栏 li 的是,当屏幕调整大小时,导航栏文本进入背景为蓝色的屏幕部分,我希望它变为灰色(与屏幕另一部分颜色相同)...

现在,我知道 mixed-blend-mode 是一个东西,但我不喜欢它反转颜色的方式...有没有办法指定 mixed 的颜色-混合模式?或者还有其他选择吗?

html, body {
margin: 0;
padding: 0;
/*background-color: #eeeeee;*/
}

div {
display: block;
}

ul {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
}

a {
text-decoration: none;
color: inherit;
}

#desktop-navbar {
text-transform: uppercase;
background-color: transparent;
width: 100%;
height: 90px;
position: fixed;
z-index:1;
}

#desktop-logo{
float: left;
}

.logo {
font-size: 42px;
font-weight: 300;
text-transform: uppercase;
color: #ffffff;
margin-top: 20px;
margin-left: 1%;
font-family: Thasadith;
font-weight: 700;
letter-spacing: 3px;
width: auto;
}

#desktop-nav-wrapper {
height: inherit;
padding: 0 45px;
font-weight: bold;
font-size: 18px;
text-transform: uppercase;
color: black;
letter-spacing: 2px;
}

#home {
height: 700px;
position: relative;
}

#home-container {
display: flex;
height: inherit;
}

#home-content {
height: auto;
width: 100%;
background: linear-gradient(90deg, #314455 63%, #dddddd 0%);
}

#desktop-nav-wrapper nav ul {
float: right;
padding-top: 35px;
font-size: 16px;
}

#desktop-nav-wrapper nav li {
position: relative;
display: inline-block;
padding-left: 35px;
color: #000000;
font-family: Thasadith;
font-weight: 900;
}
 <div id="desktop-navbar"">
<div id="desktop-nav-wrapper">
<h3 id = "desktop-logo" class="logo"><a href="/"><i class="fas fa-highlighter"></i></a></h3>
<nav>
<ul id = "desktop-nav-content">
<li><a href="#home">Casa</a></li>
<li><a href="#about">Sobre Mi</a></li>
<li><a href="#services">Servicio</a></li>
<li><a href="#gallery">Galería</a></li>
<li><a href="#contact">Contacto</a></li>
</ul>
</nav>
</div>
</div>

<div id="home">
<div id="home-container">
<div id="home-content">

</div>
</div>
</div>

最佳答案

由于渐变覆盖了整个页面宽度,因此您可以用相反的渐变为文本着色,并使其固定以模拟变色效果:

html,
body {
margin: 0;
padding: 0;
}

ul {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
}

a {
text-decoration: none;
color: inherit;
}

#desktop-navbar {
text-transform: uppercase;
background-color: transparent;
width: 100%;
height: 90px;
position: fixed;
z-index: 1;
}

#desktop-logo {
float: left;
}

.logo {
font-size: 42px;
font-weight: 300;
text-transform: uppercase;
color: #ffffff;
margin-top: 20px;
margin-left: 1%;
font-family: Thasadith;
font-weight: 700;
letter-spacing: 3px;
width: auto;
}

#desktop-nav-wrapper {
height: inherit;
padding: 0 45px;
font-weight: bold;
font-size: 18px;
text-transform: uppercase;
color: black;
letter-spacing: 2px;
}

#home {
height: 700px;
position: relative;
}

#home-container {
display: flex;
height: inherit;
}

#home-content {
height: auto;
width: 100%;
background: linear-gradient(90deg, #314455 63%, #dddddd 0%);
}

#desktop-nav-wrapper nav ul {
float: right;
padding-top: 35px;
font-size: 16px;
}

#desktop-nav-wrapper nav li {
position: relative;
display: inline-block;
padding-left: 35px;
color: #000000;
font-family: Thasadith;
font-weight: 900;
/*relevant code*/
background: linear-gradient(90deg, #dddddd 63%, #000 0%) fixed;
background-clip: text;
color: transparent;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
/**/
}
<div id="desktop-navbar">
<div id="desktop-nav-wrapper">
<h3 id="desktop-logo" class="logo"><a href="/"><i class="fas fa-highlighter"></i></a></h3>
<nav>
<ul id="desktop-nav-content">
<li><a href="#home">Casa</a></li>
<li><a href="#about">Sobre Mi</a></li>
<li><a href="#services">Servicio</a></li>
<li><a href="#gallery">Galería</a></li>
<li><a href="#contact">Contacto</a></li>
</ul>
</nav>
</div>
</div>

<div id="home">
<div id="home-container">
<div id="home-content">

</div>
</div>
</div>

关于html - 比混合混合模式更好的选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55124311/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com