由于一些奇怪的原因,我的div类样式不起作用。
1.是的,css是否正确链接 2. Yess所有div和css属性都有正确的结束标记
我有一个名为entry-title-first
的div类,然后我有entry-title-second
和entry-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>
答案 0 :(得分:3)
你需要这样做
.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>