Using :first-letter pseudo-element on input button

一曲冷凌霜 提交于 2021-02-05 09:10:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!