這應該很容易。在我的代碼和jsfiddle of it中創建一個樣式化的css無框架「按鈕」,http://www.cssbuttongenerator.com/,按鈕的行爲不同 - 鼠標圖標在鼠標懸停在按鈕內時會發生變化,並且用戶可以選擇文本。那將如何避免?CSS'按鈕'不必要地允許文本選擇
的CSS:
.simpleButton {
-moz-box-shadow:inset 0px 1px 0px 0px #cae3fc;
-webkit-box-shadow:inset 0px 1px 0px 0px #cae3fc;
box-shadow:inset 0px 1px 0px 0px #cae3fc;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #4197ee));
background:-moz-linear-gradient(center top, #79bbff 5%, #4197ee 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#79bbff', endColorstr='#4197ee');
background-color:#79bbff;
-webkit-border-top-left-radius:13px;
-moz-border-radius-topleft:13px;
border-top-left-radius:13px;
-webkit-border-top-right-radius:13px;
-moz-border-radius-topright:13px;
border-top-right-radius:13px;
-webkit-border-bottom-right-radius:13px;
-moz-border-radius-bottomright:13px;
border-bottom-right-radius:13px;
-webkit-border-bottom-left-radius:13px;
-moz-border-radius-bottomleft:13px;
border-bottom-left-radius:13px;
text-indent:0;
border:1px solid #469df5;
display:inline-block;
color:#ffffff;
font-family:Arial;
font-size:15px;
font-weight:normal;
font-style:normal;
height:45px;
line-height:45px;
width:133px;
text-decoration:none;
text-align:center;
text-shadow:1px 1px 0px #287ace;
}
.simpleButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #4197ee), color-stop(1, #79bbff));
background:-moz-linear-gradient(center top, #4197ee 5%, #79bbff 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4197ee', endColorstr='#79bbff');
background-color:#4197ee;
}
.simpleButton:active {
position:relative;
top:1px;
}
我覺得有點尷尬的兩個答案似乎是單向的正確,似乎無法確定哪一個先出現。 – matanster