Html 文本以蓝色下划线显示,它来自哪里?
我在后面的背景上显示了一些白色文本,但是文本下面显示了一条蓝线(无论浏览器如何)。这是从哪里来的Html 文本以蓝色下划线显示,它来自哪里?,html,css,Html,Css,我在后面的背景上显示了一些白色文本,但是文本下面显示了一条蓝线(无论浏览器如何)。这是从哪里来的 body { position:relative; background-color:black; font-family: Helvetica; margin: 0; /* Amount of negative space around the outside of the body */ padding: 0;
body {
position:relative;
background-color:black;
font-family: Helvetica;
margin: 0; /* Amount of negative space around the outside of the body */
padding: 0; /* Amount of negative space around the inside of the body */
}
#main_header {
position: relative;
}
#logo {
position:absolute;
top: 6px;
left: 140px;
height: 50px;
width: 50px;
}
#main_title {
position:absolute;
font-size: 15px;
color:white;
top: 50px;
left: 40px;
text-decoration:none;
text-align:center;
display:block;
}
<body>
<a href="http://theurl">
<div id = "main_header" >
<img id = "logo" src="logo.png"/>
<h2 id = "main_title">Title</h2>
</div>
</a>
正文{
位置:相对位置;
背景色:黑色;
字体系列:Helvetica;
边距:0;/*主体外部周围的负空间量*/
填充:0;/*主体内部周围的负空间量*/
}
#主割台{
位置:相对位置;
}
#标志{
位置:绝对位置;
顶部:6px;
左:140像素;
高度:50px;
宽度:50px;
}
#主标题{
位置:绝对位置;
字体大小:15px;
颜色:白色;
顶部:50px;
左:40px;
文字装饰:无;
文本对齐:居中;
显示:块;
}
尝试设置:
a img { border: none; }
a { text-decoration: none; }
锚定标记(。这可能会导致您看到的效果
你可以重写你的和其他解决方案
<body>
<div id = "main_header" >
<a href="http://theurl"><img id = "logo" src="logo.png"/></a>
<h2 id = "main_title">Title</h2>
</div>
</body>
标题
这里有一个修改你的代码的工具。你看到这里的下划线了吗?谢谢,不过我是通过Safari得到的,但是更改没有影响行。然后尝试取消设置文本装饰
属性。@aminoacys你声明了你的文档类型吗?如果单击了main_header div的任何部分,我想调用url,但是t如果我将结束锚标记扩展到h2元素之后,则蓝线会返回。对于这种情况,有没有关于如何删除它的建议?@氨基酸您是否在页面上的
标记之前声明文档类型
?是的。前几行是: