文本以蓝色下划线显示,它来自哪里? [英] Text being displayed with a blue underlining, where is it coming from?
本文介绍了文本以蓝色下划线显示,它来自哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在背景背景上显示了一些白色文字,但文字在下面显示为蓝色线条(无论浏览器如何)。这是从哪里来的?
I'm displaying some white text on a back background but the text is displayed with a blue line underneath it (regardless of the browser). Where is this coming from?
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>
推荐答案
锚定标记(< a> )不能在 div
或 h2
www.w3.org/TR/html401/struct/links.html#edef-Arel =nofollow noreferrer> HTML 4.01 。这可能会导致你看到的效果。 请继续阅读。
Anchor tags (<a>
) cannot contain block elements such as div
or h2
in HTML 4.01. This may be causing the effect you are seeing. Read on.
您可以重写您的< a>
标签以仅环绕内嵌元素(或仅指定文档类型为HTML5)。 此处是其他解决方案。
You can rewrite your <a>
tag to surround inline elements (below) only or specify that your document type is HTML5. Here are other solutions.
<body>
<div id = "main_header" >
<a href="http://theurl"><img id = "logo" src="logo.png"/></a>
<h2 id = "main_title">Title</h2>
</div>
</body>
这篇关于文本以蓝色下划线显示,它来自哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文