Html 将图像放在锚标签上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42368962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
put an image on an anchor tag
提问by Suraj
I have an ul
like below which has anchor tags.
我有一个ul
喜欢下面的锚标签。
<ul class="nav-link-bottom">
<li><a class="active" href="login.html">Existing user</a></li>
<li><a href="signup.html" style = "background-color:#000">new user</a></li>
</ul>
I want to place an image on the second anchor tag. Not sure how I can do that.
我想在第二个锚标签上放置一个图像。不知道我怎么能做到这一点。
Here's the fiddle. And the imageI want to put on the left anchor same position as the caret you see.
回答by Oke Tega
Don't really understand you question but if you want the img
to serve as link
, you could do
不太明白你的问题,但如果你想img
充当link
,你可以做
<a href="page.html"><img src="img.png"></a>
And then give the anchor tag
what ever height
or width
然后给anchor tag
什么曾经height
或width
回答by Michael Benjamin
<li><a href=""><img src="" alt=""></a></li>