CSS样式表
用于控制这些按钮样式的CSS大部分内容都很直观,不同浏览器中的稍许差别,就会导致我们下面的代码中要分别为他们应用不同的padding值,还好,这一切都是完全可以实现的。
/* BUTTONS */
.buttons a, .buttons button{
display:block;
float:left;
margin:0 7px 0 0;
background-color:#f5f5f5;
border:1px solid #dedede;
border-top:1px solid #eee;
border-left:1px solid #eee;
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:100%;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
padding:5px 10px 6px 7px; /* Links */
}
.buttons button{
width:auto;
overflow:visible;
padding:4px 10px 3px 7px; /* IE6 */
}
.buttons button[type]{
padding:5px 10px 5px 7px; /* Firefox */
line-height:17px; /* Safari */
}
*:first-child html button[type]{
padding:4px 10px 3px 7px; /* IE7 */
}
.buttons button img, .buttons a img{
margin:0 3px -3px 0 !important;
padding:0;
border:none;
width:16px;
height:16px;
}
还有一个问题就是,Internet Explorer在呈现长按钮时存在一些bug。有关这方面的信息你可以在Jehiah.cz上找到,不过在上面的CSS代码中我们通过声明width和overflow的值会在一定程度上避免问题的出现。
为按钮添加一点色彩
在Wufoo中,我们为中性动作(这里,作者把change password一类的动作叫作中性动作,把“确定”、“提交”一类的动作叫作正向动作,而把“放弃”、“取消”一类的动作叫作负向动作)的hover值设为蓝色,而把正向动作和负向动作分别设为绿色和红色。下面的样式代码中就是我们用不同的颜色区分“添加”、“保存”一类的正向动作和“取消”、“删除”一类的负向动作的。感觉还不错,当然你也可以选择你喜欢的他颜色来使用。
/* STANDARD */
button:hover, .buttons a:hover{
background-color:#dff4ff;
border:1px solid #c2e1ef;
color:#336699;
}
.buttons a:active{
background-color:#6299c5;
border:1px solid #6299c5;
color:#fff;
}
/* POSITIVE */
button.positive, .buttons a.positive{
color:#529214;
}
.buttons a.positive:hover, button.positive:hover{
background-color:#E6EFC2;
border:1px solid #C6D880;
color:#529214;
}
.buttons a.positive:active{
background-color:#529214;
border:1px solid #529214;
color:#fff;
}
/* NEGATIVE */
.buttons a.negative, button.negative{
color:#d12f19;
}
.buttons a.negative:hover, button.negative:hover{
background:#fbe3e4;
border:1px solid #fbc2c4;
color:#d12f19;
}
.buttons a.negative:active{
background-color:#d12f19;









