Html 如何在 div 标签中包含图片链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19523640/
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
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 14:42:11 来源:igfitidea点击:
How can include image link within the div tag
提问by Praveen Edachal
I am working with an html code. I am trying to make image as a hyperlink.But it works only without the div tag.How can i include image link within the div tag?
我正在使用 html 代码。我正在尝试将图像作为超链接。但它只能在没有 div 标签的情况下工作。如何在 div 标签中包含图像链接?
Here is the code i am using
这是我正在使用的代码
<div class="image">
<a href=""><img src="images/01 (22).jpg" width="360" height="200" alt=""></a>
</div>
Thanks..
谢谢..
回答by underscore
Use the DIV
inside link (a
);
使用DIV
内部链接 ( a
);
<a href="">
<div class="image">
<img src="images/01 (22).jpg" width="360" height="200" alt="">
</div>
</a>