我在将外部CSS文件中的样式添加到以下HTML代码段时遇到问题。
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>About Me</title>
</head>
<body>
<img src="https://s3.amazonaws.com/codecademy-blog/assets/46838757.png"/>
<p>We're Codecademy! We're here to help you learn to code.</p><br/><br/>
<div>
<a href="www.google.com"><span>LINK</span></a>
</div>
</body>
</html>
&#13;
相应的CSS如下;似乎有问题的行是 span 块中的 text-decoration 行,由于某种原因,它不是& #39; t被应用。有什么输入吗?
img {
display: block;
height: 100px;
width: 300px;
margin: auto;
}
p {
text-align: center;
font-family: Garamond, serif;
font-size: 18px;
}
/*Start adding your CSS below!*/
div {
height: 50px;
width: 120px;
border-color: #6495ED;
background-color: #BCD2EE;
border-style: dashed;
border-width: 3px;
border-radius: 5px;
margin: auto;
text-align: center;
}
span {
color: blue;
font-family: times;
text-decoration: none;
}
&#13;
答案 0 :(得分:0)
此行来自锚标记,而不是来自span。检查下面的css:
img {
display: block;
height: 100px;
width: 300px;
margin: auto;
}
p {
text-align: center;
font-family: Garamond, serif;
font-size: 18px;
}
/*Start adding your CSS below!*/
div {
height: 50px;
width: 120px;
border-color: #6495ED;
background-color: #BCD2EE;
border-style: dashed;
border-width: 3px;
border-radius: 5px;
margin: auto;
text-align: center;
}
span {
color: blue;
font-family: times;
}
a {
text-decoration: none;
}
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>About Me</title>
</head>
<body>
<img src="https://s3.amazonaws.com/codecademy-blog/assets/46838757.png"/>
<p>We're Codecademy! We're here to help you learn to code.</p><br/><br/>
<div>
<a href="www.google.com"><span>LINK</span></a>
</div>
</body>
</html>
答案 1 :(得分:0)
使用此
a {
color: blue;
font-family: times;
text-decoration: none;
}