gpt4 book ai didi

html - 如何让 div 类样式起作用?

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:16 25 4
gpt4 key购买 nike

由于某些奇怪的原因,我的 div 类样式不起作用。

1.是的,CSS 链接正确2. 是的,所有的 div 和 css 属性都有正确的结束标签

我有一个名为 entry-title-first 的 div 类,然后我有 entry-title-secondentry-title-third 但是出于某种原因,所有类都采用 entry-title-first 的样式是什么导致了这个问题?

.entry-title-first {
color:#fff;
font-family:Trade Gothic;
font-size:28px;
line-height:26px;
margin-top:-15px;
font-weight:900;
padding-bottom:8px;
}

.entry-title-first a:link, a:visited, a:hover{
color:#fff;
text-decoration:none;
}

.entry-title-second {
color:#000;
font-family:Trade Gothic;
font-size:28px;
line-height:26px;
margin-top:-15px;
font-weight:900;
padding-bottom:8px;
}

.entry-title-second a:link, a:visited, a:hover{
color:#000;
text-decoration:none;
}

html

<div class="entry-title-first"><a href="/">Link Name</a></div>
<div class="entry-title-second"><a href="/">Link Name</a></div>

最佳答案

你需要这样做

.entry-title-first a:link, .entry-title-first  a:visited {
color:#fff;
text-decoration:none;
}
.entry-title-first a:hover {
color:#f00;
}

示例

body {
background: gray;
}
.entry-title-first {
color:#000;
font-family:Trade Gothic;
font-size:28px;
line-height:26px;
margin-top:15px;
font-weight:900;
padding-bottom:8px;
}

.entry-title-first a:link, .entry-title-first a:visited {
color:#fff;
text-decoration:none;
}
.entry-title-first a:hover {
color:#f00;
}

.entry-title-second {
color:#000;
font-family:Trade Gothic;
font-size:28px;
line-height:26px;
margin-top:15px;
font-weight:900;
padding-bottom:8px;
}

.entry-title-second a:link, .entry-title-second a:visited {
color:#000;
text-decoration:none;
}

.entry-title-second a:hover {
color:#ff0;
}
<div class="entry-title-first"><a href="/">Link Name 1</a></div>
<div class="entry-title-second"><a href="/">Link Name 2</a></div>

关于html - 如何让 div 类样式起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36026474/

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