gpt4 book ai didi

html - 透明工具栏上的透明文本

转载 作者:行者123 更新时间:2023-11-28 02:23:10 27 4
gpt4 key购买 nike

我有一个部分透明的导航栏,我希望上面的文字完全透明。我这里的 css 使栏上的文本完全透明,但它在其下方显示了稍微透明的工具栏。我想让正文背景通过文本显示出来。

感谢任何帮助,谢谢!

body {
background: #db8669;
}

.header {
z-index: 99;
position: fixed;
width: 100%;
height: 3rem;
background-color: #00000077;
color: #ffffff00;
font-family: 'Encode Sans Expanded', sans-serif;
text-align: center;
}

.header:hover {
color: #ffffffdd;
}

.header li {
display: inline;
list-style-type: none;
font-size: .75rem;
}

.header li:last-child {
margin-right: 0;
}

.header li:hover {
color: #ddffee;
cursor: pointer;
}

.header ul {
height: 3rem;
float: right;
display: inline-block;
}

.header p {
font-family: 'Pacifico', cursive;
font-size: 1rem;
display: inline-block;
float: left;
margin-top: .3rem;
margin-left: .3rem;
height: 3rem;
}

.header .toolbar {
width: 100%;
display: inline-block;
}

.header nav {
margin-right: 1rem;
}
<body>
<div class="header">
<div class="toolbar">
<div id="logo"><p>Joe Schmoe</p></div>
<nav>
<ul>
<li id=florallink>Florals</li>
<li id=landscapelink>Landscapes</li>
<li id=portraitlink>Portraits</li>
<li id=stilllink>Still Life</li>
<li id=mystorylink>My Story</li>
<li id=eventslink>Events</li>
<li id=contactlink>Contact Me</li>
</ul>
</nav>
</div>
</div>
</body>

最佳答案

您尝试的方法行不通。因为如果您将其设为透明,文本会采用其父元素的颜色。它不会直接对 header 元素进行验证。就像@dirk 说的那样,在里面“打洞”

您可以将文本颜色设置为与正文背景颜色相同的颜色。这会给人这样的想法,即文本是“在标题中打洞”。

body {
background: #db8669;
}

.header {
z-index: 99;
position: fixed;
width: 100%;
height: 3rem;
background-color: #000000aa;
color: #ffffff00;
font-family: 'Encode Sans Expanded', sans-serif;
text-align: center;
}

.header:hover {
color: #db8669;
}

.header li {
display: inline;
list-style-type: none;
font-size: .75rem;
}

.header li:last-child {
margin-right: 0;
}

.header li:hover {
color: #dc8668;
cursor: pointer;
}

.header ul {
height: 3rem;
float: right;
display: inline-block;
}

.header p {
font-family: 'Pacifico', cursive;
font-size: 1rem;
display: inline-block;
float: left;
margin-top: .3rem;
margin-left: .3rem;
height: 3rem;
}

.header .toolbar {
width: 100%;
display: inline-block;
}

.header nav {
margin-right: 1rem;
}
<body>
<div class="header">
<div class="toolbar">
<div id="logo"><p>Joe Schmoe</p></div>
<nav>
<ul>
<li id=florallink>Florals</li>
<li id=landscapelink>Landscapes</li>
<li id=portraitlink>Portraits</li>
<li id=stilllink>Still Life</li>
<li id=mystorylink>My Story</li>
<li id=eventslink>Events</li>
<li id=contactlink>Contact Me</li>
</ul>
</nav>
</div>
</div>
</body>

关于html - 透明工具栏上的透明文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48091748/

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