I'm trying to create a button that links to another website and I want to add my own image to it. should I use the <input>
tag or the <button>
tag? Thank you!
如果要添加到另一个网站的链接,则需要使用href标记,并且由于要添加图像作为链接,则需要在href标记内添加img标记,如下所示给定的代码:
<a href="Your Destined Page"><img src="Your Desired Image"/></a>
you can use an HTML form :
<form action="http://yoursite.com">
<input type="submit" value=" to your site">
</form>
Whatever you want you can use.
You can use a button or input as well and give it a background (either color or image) Check this out
<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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.