如何将我自己的图像添加到链接到 HTML 和 CSS 中另一个网站的按钮?
How do i add my own image to a button that links to another website in HTML & CSS?
我正在尝试创建一个链接到另一个网站的按钮,并且我想向其中添加我自己的图像。
我应该使用 <input>
标签还是 <button>
标签?
谢谢!
如果要将 link 添加到另一个网站,则需要使用 href 标签,并且由于要将图像添加为 link,则需要在 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;
}
我正在尝试创建一个链接到另一个网站的按钮,并且我想向其中添加我自己的图像。
我应该使用 <input>
标签还是 <button>
标签?
谢谢!
如果要将 link 添加到另一个网站,则需要使用 href 标签,并且由于要将图像添加为 link,则需要在 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;
}