[英]How do i add my own image to a button that links to another website in HTML & CSS?
我正在尝试创建一个链接到另一个网站的按钮,我想向其中添加自己的图像。 我应该使用<input>
标记还是<button>
标记? 谢谢!
如果要添加到另一个网站的链接,则需要使用href标记,并且由于要添加图像作为链接,则需要在href标记内添加img标记,如下所示给定的代码:
<a href="Your Destined Page"><img src="Your Desired Image"/></a>
您可以使用HTML表单:
<form action="http://yoursite.com">
<input type="submit" value=" to your site">
</form>
无论您要使用什么。
您也可以使用按钮或输入并为其提供背景(颜色或图像)
<button type="button" id="button1">My Button with image in background</button>
#button1 {
-webkit-appearance : none;
-moz-appearance : none;
border : none;
background : url('http://upload.wikimedia.org/wikipedia/en/thumb/f/f2/Core_Image_icon.png/96px-Core_Image_icon.png');
background-size : 100% 100%;
background-repeat : no-repeat;
width : 200px;
height : 100px;
box-shadow : 2px 2px 2px 1px gray;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.