I am styling a page where I have only been given access to the CSS files.
I am looking to alter the style of an input element if it's value is not blank.
Here's what I have so far...
<input id="myInput" type="text" name="myInput" autocomplete="off" placeholder="Enter your Card Number">
and
input {
font-style:italic;
}
input:not([value='']) {
font-style:normal;
}
This doesn't work though as the text is never italicised.
Is it even possible to achieve this taking into consideration I can only edit the CSS file.?
The easiest way to select input elements is to use CSS attribute selectors. These selectors will select all the input elements in the document.
Looks like you're using HTML5...if so just edit your PLACEHOLDER tag
::-webkit-input-placeholder {font-style: italic} /*Chrome */
:-moz-placeholder {font-style: italic} /*ff*/
:-ms-input-placeholder {font-style: italic} /*ie latest */
JSFIDDLE:
http://jsfiddle.net/Riskbreaker/wCff9/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With