Thursday, February 7, 2019

html - How do I make a placeholder for a 'select' box?



I'm using placeholders for text inputs which is working out just fine. But I'd like to use a placeholder for my selectboxes as well. Of course I can just use this code:







But the 'Select your option' is in black instead of lightgrey. So my solution could possibly be CSS-based. jQuery is fine too.



This only makes the option grey in the dropdown (so after clicking the arrow):




option:first {
color: #999;
}


The question is: How do people create placeholders in selectboxes? But it has already been answered, cheers.



And using this results in the selected value always being grey (even after selecting a real option):



select {

color: #999;
}

Answer



A non-CSS - no JavaScript/jQuery answer:









No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...