html - 按钮值属性不采用 css
问题描述
您好,我需要使用 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>
推荐阅读
- node.js - 使用 web3 智能合约时,Mocha 测试在完成后挂起
- jsf - a4j:支持在提交表单之前进行部分更新
- java - 提供者是弹簧数据休息,客户端是使用假装页面不起作用
- architecture - 将开发委派给团队成员的方法
- javascript - grunt-contrib-concat 中连接的 .js 文件的源映射错误
- python - 如何将熊猫数据框传递给`scipy.optimize.curve_fit`或`scipy.stats.linregress`
- dart - Flutter 如何在 Text 小部件中复制部分文本?
- javascript - jQuery 切换不适用于 next() 函数
- r - 如何粘贴逗号分隔和引号中的矢量元素?
- php - 为什么我的登录脚本将我发送到一个空白的白页?错误报告