我想做一个像这样的按钮[icon.png text-here]
这样按钮上会有一个图标,然后是文本。
到目前为止,我的代码:
[css]
.icon {
background: url('icon.png');
float: right;
width: 40px;
height: 40px;
}
[html]
<input type="submit" id="submit" class="icon" value="Log Me In"/><input type="button" id="cls" value="Clear All"/>
请告诉我我做错了什么,任何帮助将不胜感激,谢谢!
最佳答案
只需在图标和一些CSS上添加位置即可为其余按钮设置样式。
的HTML
<input type="submit" id="submit" class="icon" value="Log Me In"/>
的CSS
input{
/* Change `http://placehold.it/50x50` to your icon */
background:green url("http://placehold.it/50x50") 10px center no-repeat;
height: 75px;
padding: 10px 10px 10px 70px;
}
http://jsfiddle.net/daCrosby/tvNCa/1/