【发布时间】:2014-08-22 19:15:44
【问题描述】:
下面是custom.css文件中的代码,是html页面内部的外部css。
button {
cursor: pointer;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
border: none;
padding: 0;
margin: 0;
background: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
我想用我自己的风格覆盖它。我在HTML中尝试了followig,但它不起作用:
<style> .myButton {background-color:initial; } </style>
<button class="myButton">Add</button>
有什么建议吗?
【问题讨论】:
-
由于特殊性,您需要这样做
inline。 css-tricks.com/specifics-on-css-specificity -
您的第二个
<style>定义在哪里?在你的<head>? -
事实上它应该可以工作,因为类选择器比元素选择器具有更高的特异性值。