gpt4 book ai didi

html - 显示带有蓝色下划线的文本,它来自哪里?

转载 作者:太空宇宙 更新时间:2023-11-04 04:56:54 25 4
gpt4 key购买 nike

我在背景上显示了一些白色文本,但文本下方显示有一条蓝线(与浏览器无关)。这是从哪里来的?

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>

enter image description here

最佳答案

anchor 标记 ( <a> ) 不能包含 block 元素,例如 divh2HTML 4.01 .这可能会导致您看到的效果。 Read on .

您可以重写您的 <a>标记仅包围内联元素(如下)或指定您的文档类型为 HTML5。 Here是其他解决方案。

<body>
<div id = "main_header" >
<a href="http://theurl"><img id = "logo" src="logo.png"/></a>
<h2 id = "main_title">Title</h2>
</div>
</body>

关于html - 显示带有蓝色下划线的文本,它来自哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12255029/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com