文字装饰在DIV内不起作用 [英] Text Decoration not working within DIV
本文介绍了文字装饰在DIV内不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下CSS:
.top-category-item {
height:338px;
背景颜色:黑色;
职位:亲属;
}
.top-category-item-copy {
width:100%;
/ *不支持RGBa的网页浏览器的回退* /
background:rgb(0,0,0);
/ *具有0.8不透明度的RGBa * /
background:rgba(0,0,0,0.8);
bottom:0px;
位置:绝对;
padding-left:5px;
padding-right:15px;
padding-top:2px;
padding-bottom:4px;
box-sizing:border-box;
-moz-box-sizing:border-box; / * Firefox * /
-webkit-box-sizing:border-box; / * Safari * /
font-family:格鲁吉亚,Times New Roman,serif;
font-size:35px;
line-height:36px;
font-weight:bold;
颜色:#F1F1F1;
}
.top-category-item-copy a {
text-decoration:none;
}
这是我的HTML:
< a href =>
< div class =top-category-item low-gutter>
< img src =images / feature-placeholder.jpgalt =最新图片占位符/ width = 100%height = 100%>
< div class =top-category-item-copy>早期法国区青少年宵禁获得混合反应。< / div>
< / div>
< / a>
我已经搜索了Stack Overflow以解决这个问题:
-
尝试将语法换成一些小例子
.class-name a:link {text-decoration:none;}
-
a {text-decoration:none;}
,这有效,但感觉像是一种解决方法,而不是一个真正的解决方案 在您的HTML中, Tried swapping the syntax around a little e.g.
.class-name a:link {text-decoration: none;}
Tried declaring a global
a {text-decoration: none;}
, this works but it feels like a workaround, not a real solution
top-category-item-copy
是一个解决方案 code> div ,并以 a / p>
a
作为父项。您的CSS在 .top-category-item-copy
中标记为没有任何文本装饰。<I have the following CSS:
.top-category-item {
height: 338px;
background-color: black;
position: relative;
}
.top-category-item-copy {
width: 100%;
/* Fallback for web browsers that doesn't support RGBa */
background: rgb(0, 0, 0);
/* RGBa with 0.8 opacity */
background: rgba(0, 0, 0, 0.8);
bottom: 0px;
position: absolute;
padding-left: 5px;
padding-right: 15px;
padding-top: 2px;
padding-bottom: 4px;
box-sizing:border-box;
-moz-box-sizing:border-box; /* Firefox */
-webkit-box-sizing:border-box; /* Safari */
font-family: Georgia, Times New Roman, serif;
font-size: 35px;
line-height: 36px;
font-weight: bold;
color: #F1F1F1;
}
.top-category-item-copy a {
text-decoration: none;
}
And this is my HTML:
<a href="">
<div class="top-category-item low-gutter">
<img src="images/feature-placeholder.jpg" alt="latest-image-placeholder"/ width=100% height=100%>
<div class="top-category-item-copy">Earlier French Quarter curfew for youths gets mixed reaction.</div>
</div>
</a>
I've searched Stack Overflow for solutions to this problem:
解决方案
In your HTML, top-category-item-copy
is a div
, with an a
as the parent. Your CSS is saying "No text decorations for all a
tags within .top-category-item-copy
."
这篇关于文字装饰在DIV内不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文