您好,我需要使用 value 属性在按钮上应用 css。 但它没有采用 css
button[value=Export List to Excel] {
margin-top: 14px;
background: red;
}
<button type="submit" id="cp_export_excel" name="cp_export_excel" value="Export List to Excel" class="btn btn-warning form-submit icon-before"><span class="icon glyphicon glyphicon-export" aria-hidden="true"></span> Export List to Excel</button>
我将如何实现这个。我只需要专门使用值属性。有人可以帮忙吗。
最佳答案
您必须将您的值表达式放在引号中,因为您的空格会破坏 CSS 规则匹配:
button[value="Export List to Excel"] {
margin-top: 14px;
background: red;
}
<button type="submit" id="cp_export_excel" name="cp_export_excel" value="Export List to Excel" class="btn btn-warning form-submit icon-before"><span class="icon glyphicon glyphicon-export" aria-hidden="true"></span> Export List to Excel</button>
关于html - 按钮值属性不采用 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53007941/