是否可以让超链接看起来像带有文本的按钮?
我们可以用代码制作超链接按钮:
<a href="..."> <img src="button.png" width="100" height="50" alt="Some text"></img> </a>
但我还需要按钮中心的文本。
谢谢。
最佳答案
我建议,在不知道您想要什么的情况下,并假设以下标记:
<a href="#"><img src="path/to/image.png" /><span>Some text</span></a>
a {
position: relative;
display: inline-block;
}
a span {
position: absolute;
top: 50%;
left: 50%;
margin-top: -1em;
margin-left: -50%;
width: 100%;
height: 2em;
color: #f90;
background-color: rgba(0,0,0,0.5);
}
关于带有图像和文本的 HTML 超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11347710/