css text-decoration underline not working when applied to the text of an input button

你离开我真会死。 提交于 2019-12-25 06:54:08

问题


Pretty self explanatory. I have an input button. It has text. It has a css class. The css class has the attribute "text-decoration:underline;". The underline does not show up in firefox. I tried adding "!important" to the attribute but to no avail. Apparently this is a known issue. Anyone know a workaround?


回答1:


Apply position: absolute, display: block, or float: left to the button. (display: block recommended.) Don't ask why.

You may also notice that Firefox will render the underline in quirks mode.




回答2:


Better way is to use display:inline-block it does not alter position of element.




回答3:


I don’t see any problem with underlining the text in <input type=button> on Firefox (technically, I mean; I see many usability problems with the idea). You may have something else on your page that prevents the underlining.

On the other hand, if you wish to underline just parts of the text, you can use <button>, which lets you use markup in the text, even <u>.



来源:https://stackoverflow.com/questions/8809790/css-text-decoration-underline-not-working-when-applied-to-the-text-of-an-input-b

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