正如您从下面的示例中看到的那样,我有一个黑色背景和红色链接,以强调单击链接时在我的链接上显示虚线边框的问题。我加了border-style:none
但是好像没有什么效果。有没有其他方法可以消除单击链接时出现在链接周围的虚线边框?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body
{
height: 100%;
margin: 0;
padding: 0;
font-weight:normal;
font-size:12pt;
font-family: Verdana, Arial, Helvetica, serif, sans-serif;
background:black;
}
#linksouter
{
margin: 0;
padding: 0;
border-style:solid;
border-width:0px;
position:absolute;
top: 0px;
left: 0px;
width: 80px;
text-align:left;
}
#linksinner
{
margin: 80px 0 0 .5em;
width:100%;
display:inline;
height:100%;
}
#linksinner a
{
color:red;
text-decoration: none;
display:block;
margin: 5px 0 0 0;
border-style:none;
}
</style>
</head>
<body>
<div id="linksouter">
<div id="linksinner">
<a href="#">1</a>
<a href="#">1</a>
<a href="#">1</a>
<a href="#">1</a>
<a href="#">1</a>
</div>
</div>
</body>
</html>
最佳答案
您看到的边框称为轮廓。您可以通过将此样式放入您的 a
规则中来摆脱它:
outline:none;
我个人总是将它定义为样式表顶部附近的一揽子 a
规则(我真的不喜欢轮廓,尽管我知道它们有用)
a { outline:none; }
希望对你有帮助
关于html - 设置边框样式 :none; on my anchor tags but border shows up when I click on a link - why?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1134929/