作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用这个 codepen 中的 CSS在悬停时创建一个很酷的超链接下划线效果。但是当我去实现它时,我仍然可以看到文本装饰被应用于超链接,即使我将它设置为 none 用于 a 标记。什么问题?
编辑:我希望将炫酷的超链接效果应用于仅查看战斗世界链接。
CSS
section.custom_view h2, section.custom_view h3, section.custom_view h4 {
color: #666;
font-size: 150%;
padding-top: 1.25em;
margin-right: 0.625em; }
section.custom_view ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden; }
section.custom_view li {
float: left;
margin-bottom: 0.625em; }
section.custom_view li a {
display: inline-block;
font-size: 150%;
padding-top: 1.25em;
text-decoration: none; }
section.custom_view li a, section.custom_view li a:visited, section.custom_view li a:hover, section.custom_view li a:active {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
position: relative;
transition: 0.5s color ease;
text-decoration: none; }
section.custom_view li a:hover {
color: #990000; }
section.custom_view li a.before:before, section.custom_view li a.after:after {
content: "";
transition: 0.5s all ease;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute; }
section.custom_view li a.after:after {
bottom: -0.25em; }
section.custom_view li a.before:before, section.custom_view li a.after:after {
height: 5px;
height: 0.35rem;
width: 0;
background: #990000; }
section.custom_view li a.third:after, section.custom_view li a.sixth:before, section.custom_view li a.sixth:after {
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%); }
section.custom_view li a.before:hover:before, section.custom_view li a.after:hover:after {
width: 100%; }
HTML
<body>
<! -- some more HTML -->
<section class='content'>
<ul class='breadcrumbs'>
<li><a href="/">Home</a></li>
<li>Searching for Worlds</li>
</ul>
<section class='custom_view'>
<ul>
<li>
<h2>Viewing All Trials</h2>
</li>
<li>
<a class="third after" href="/search?limit=15&locale=en&offset=0&recruiting_status=Recruiting&search_header_menu_left=Viewing+All+Battle+Worlds&search_header_menu_right=View+All+Worlds&search_terms=Mars&zip_code=90033">View Battle Worlds Only</a>
</li>
</ul>
</section>
<! -- some more HTML -->
</section>
</body>
最佳答案
你的 CSS 被应用到类 custom_view
的 section
元素,因为它在你所有的 CSS 选择器中都是这样声明的:
section.custom_view
但是,您在 HTML 中的 section
有一类 content
:
<section class='content'>
要完成这项工作,您需要匹配类。
为所有 custom_view
实例将 CSS 中的类更改为 content
或
将 HTML 中 section
的类更改为 class='custom_view'
关于html - 为什么这个 CSS 没有禁用超链接中的文本装饰?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30270042/
我是一名优秀的程序员,十分优秀!