问题
I'm trying to create a button with only the first letter underlined. Obviously I can not use tags , then I would realize it with css, by using the pseudo element :first-letter. It works very well in other contexts, but in button doesn't work. There are other solutions?
回答1:
Since you haven't shared your code, I'll take a bold guess here.
You're using <input type="button" value="Some Value">
, because there's no actual text inside (The displayed text comes from the value=
attribue), :first-letter
wouldn't work (because it works on the text inside of the element).
Instead, use <button>Some Value</button>
, it should work fine.
来源:https://stackoverflow.com/questions/14135832/using-first-letter-pseudo-element-on-input-button