See the examples below. I'm trying to style my CSS through value
that it has, but it's not working.
I've assembled 3 examples, one so that if input
has [value="red"]
it should have a red border. But even if you type red
in it nothing changes, and if it already comes with the value set to red
, even if you delete this value it continues with the red border.
I have also done a test with the select, already leaving an option with option[value="3"]
selected using selected
CSS tb is not applied ...
Is there a way to use value
in input and use it as a selector to apply some class with CSS ? >
[value="red"] {
border: 2px solid red;
}
select > option[value="3"] {
border: 2px solid red;
}
Digite "red" nesse input e nada acontece<br>
<input type="text" value="" />
<br><br>
Esse input já está com o value=red e o CSS funcionou, <b>mas se eu apagar ele continua com o estilo!</b><br>
<input type="text" value="red" /><br><br>
Esse Select já está com o option de value=3 selecionado, mas nada acontece<br>
<select name="qa_contact">
<option value="1">opt 1</option>
<option value="2">opt 2</option>
<option value="3" selected="selected">opt 3</option>
</select>