【发布时间】:2012-07-10 07:46:38
【问题描述】:
完全困惑!我尝试用几种不同的方式重写text-decoration: none 行。我还设法通过定位文本来调整文本大小,但 text-decoration: none 代码不会占用。
非常感谢您的帮助。
代码
.widget
{
height: 320px;
width: 220px;
background-color: #e6e6e6;
position: relative;
overflow: hidden;
}
.title
{
font-family: Georgia, Times New Roman, serif;
font-size: 12px;
color: #E6E6E6;
text-align: center;
letter-spacing: 1px;
text-transform: uppercase;
background-color: #4D4D4D;
position: absolute;
top: 0;
padding: 5px;
width: 100%;
margin-bottom: 1px;
height: 28px;
text-decoration: none;
}
a .title
{
text-decoration: none;
}
<a href="#">
<div class="widget">
<div class="title">Underlined. Why?</div>
</div>
</a>
【问题讨论】:
-
你的文字没有为我加下划线。
-
我和 Nikola 在一起,没有下划线。此外,在发布演示时,请考虑整理您的空白;目标是制作一个我们可以轻松使用、查看和阅读的演示。此外,嵌套在
a元素中的div在 HTML5 之外是无效的,因此在使用该结构时请确保您的文档类型。 -
我没有看到任何下划线。
-
根据我的测试,它在 IE7 和 IE6 中有下划线。
-
在下面查看我(和 Woz)的答案。或者,您可以将 标签移动到 id 为“widget”的 div 标签内,它应该可以工作。
标签: css html text-decorations