[英]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.