gpt4 book ai didi

HTML/CSS : how to remove the box around link element?

转载 作者:行者123 更新时间:2023-11-28 16:20:33 24 4
gpt4 key购买 nike

我是 HTML 和 CCS 的新手。我想要一个不可见的链接,但我不想直接设置“a”标签的样式,而是想设置其父元素的样式,使其不可见。

这是我尝试过的:

div {
color: white;
border: none;
}

a {
color: inherit;
border: inherit;
}

a:link {
text-decoration: none;
}
<html>

<body>
<div><a href='/trap'> inherit </a></div>
</body>

</html>

它不显示 'a' 标签内的文本,但它周围仍然显示一个框,我怎样才能去掉那个框?

最佳答案

我猜你说的是大纲框。您可以使用以下方法删除它:

div{
color: white;
border: none;
}

a, a:focus{
color: inherit;
border: inherit;
outline:none;
}
a:link{
text-decoration: none;
}
<html>
<body>
<div><a href='/trap'> inherit </a></div>
</body>
</html>

关于HTML/CSS : how to remove the box around link element?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52174986/

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