Last active
June 23, 2017 15:38
-
-
Save movii/b1212537464978a276547d46997a05c5 to your computer and use it in GitHub Desktop.
使用 CSS 伪类为 select 元素添加 placeholder: 4. 可能是正确的答案
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
select:required:invalid { | |
color: gray; | |
} | |
option[value=""][disabled] { | |
display: none; | |
} | |
option { | |
color: black; | |
} | |
</style> | |
<select required> | |
<option value="" disabled selected>Select something...</option> | |
<option value="1">One</option> | |
<option value="2">Two</option> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment