【问题标题】:Make a HMTL <a href> hyperlink not appear as a hyperlink使 HTML <a href> 超链接不显示为超链接
【发布时间】:2017-12-09 21:35:12
【问题描述】:
我正在使用 php、html 和 css 的组合制作一个网站(用于学校作业)。我目前正在网站的初始设计阶段工作,由于我对 html / css 缺乏经验,我正在慢慢学习尝试学习的教程。
包括我的横幅的超链接:
不包括我的横幅看起来像这样的超链接:
我想要有链接的功能,但是没有链接的视觉设计效果。
必要的代码是:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<center>
<div id = "indexBackgroundOne"><h2 style="font-family:verdana"> Q U E S T S ®</h2></div>
</center>
</html>
谢谢!
【问题讨论】:
标签:
html
css
hyperlink
href
【解决方案1】:
在你的 style.css 文件中试试这个
#indexBackgroundOne h2 a{
text-decoration: none;
color:black;
}
这是一个示例代码:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<style>
#indexBackgroundOne h2 a{
text-decoration: none;
color:black;
}
</style>
<center>
<div id = "indexBackgroundOne"><h2 style="font-family:verdana"> Q U E S T S ®</h2></div>
</center>
</html>
【解决方案2】:
试试这个以获得想要的效果:
.no-style {
text-decoration: none;
color: black;
}
<center>
<div id = "indexBackgroundOne">
<h2 style="font-family:verdana">
<a href="" class="no-style">Q U E S T S ®</a>
</h2>
</div>
</center>
或者如果你想要内联样式:
<center>
<div id = "indexBackgroundOne">
<h2 style="font-family:verdana;">
<a href="" style="text-decoration:none;color:black;"> Q U E S T S ®
</a>
</h2>
</div>
</center>
【解决方案3】:
如果你使用的是内联 css,你可以这样使用 -
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<center>
<div id = "indexBackgroundOne"><h2 style="font-family:verdana;text-decoration: none;color:black;"><a href="" style="text-decoration: none;color:black;"> Q U E S T S ®</a></h2></div>
</center>
</html>
【解决方案4】:
.noline{
text-decoration:none;
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<center>
<div id = "indexBackgroundOne"><a class="noline"href="#your link"><h2 style="font-family:verdana"> Q U E S T S ®</h2></a></div>
</center>
</html>
您可以创建一个类并将其添加到并在 css 中创建 text-decoration:none