Shaswati Bhattacharyya
Shaswati Bhattacharyya

Reputation: 261

Button Value attribute not taking css

Hello I need to apply css on a button using value attribute. But it's not taking the 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>

How will I implement this one. I need to specifically use value attribute only.Can somebody please help.

Upvotes: 0

Views: 44

Answers (1)

Justinas
Justinas

Reputation: 43507

You must put your value expression in quotes, as your spaces breaks CSS rule match:

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>

Upvotes: 1

Related Questions