带有图像和文本的HTML超链接

Vic*_*r_Z 5 html text image button hyperlink

是否可以使超链接看起来像按钮WITH文本?

我们可以用代码制作超链接按钮:

<a href="..."> <img src="button.png" width="100" height="50" alt="Some text"></img> </a>
Run Code Online (Sandbox Code Playgroud)

但我还需要按钮中心的TEXT.

谢谢.

Rya*_*sas 3

可以通过将按钮设置为背景来实现:

<a href="..." style="text-align:center; background: url('button.png'); width: 100px; height: 50px;">Your text</a>
Run Code Online (Sandbox Code Playgroud)

但我会尽量避免使用带有背景图像的按钮(除非它们是奇怪的形状)。相反,我会尝试使用 CSS3。