gpt4 book ai didi

html - 文本 : decoration is not working for my link

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

我是 CSS 的新手,我只是想知道为什么我的按钮会一直变成蓝色并带有下划线,即使我设置了 text-decoration: none。

编辑:我添加了 -> a:hover 和 !important。现在下划线不见了,但它仍然变成蓝色?

下面是我尝试运行的 HTML 和 CSS 文件的片段:

 

.container {
max-width: 928px;
}

h1, h2, p, a {
font-family: 'Helvetica Neue Thin', 'HelveticaNeue-Thin', 'helvetica neue', helvetica, arial, 'lucida grande', sans-serif;
}

h1 {
font-size: 64px;
font-weight: 100;
margin-bottom: 20px;
}


a:hover{
text-decoration: none;
}

a {
font-size:18px;
font-weight: 200;
background-color: rgba(238,68,95,0.9);
padding: 7px 22px 7px 22px;
border-radius: 4px;
color: white;
text-decoration: none !important;
}

.main {
height: 550px;
padding-top: 55px;
background: url(https://s3.amazonaws.com/codecademy-content/projects/shutterbugg/intro.jpg);
}

.main p {
font-size: 26px;
font-weight: 200;
margin-bottom: 40px;
}

.section .row {
padding-top: 50px;
padding-bottom: 50px;
border-bottom: 1px solid #dbdbdb;
}

.store {
text-align: center;
border-bottom: 0px;
padding-bottom:100px
}

.footer {
border-top: 1px solid #dbdbdb;
background-color: #f3f3f3;
padding: 20px 0px 80px;
}

.footer ul {
list-style-type: none;
padding-left: 0;
}

.footer li {
color: #999;
font-weight: 600;
}

@media (max-width: 500px) {
.col-md-6 img {
padding: 50px;
width: 100%;
}
}
    <!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- The main section -->
<div class="main">
<div class="container">
<h1>Introducing Shutterbugg</h1>
<p>Capture the moments that matter.</p>
<a href="#">Download Shutterbugg</a>
</div>
</div>
</body>
</html>

最佳答案

尝试!important

它是一个覆盖元素上任何 css 规则的 css 选项

  color: white;
text-decoration: none !important;
}

您需要在鼠标悬停时指定元素。

a:hover{
text-decoration: none;
}

关于html - 文本 : decoration is not working for my link,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35448900/

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