how to underline the access key in an input button

柔情痞子 提交于 2019-12-11 12:43:09

问题


I have a button and I would like to underline the access key letter, <u></u> doesn't work, and C&#818; (C̲) changes the font, it should be verdana

    <input class="boton" type="button" value="C&#818;ancel" accesskey="C" onclick="cancel();"/>

In my css I put the font type:

input.boton{

font: bold 11px verdana !important;
color: #000;

 }

How can I do this?


回答1:


There's no HTML entity you can apply that would render an underline. Inside a value attribute you cannot use other HTML tags, so you can't render an underline this way. Using a Unicode combining low line may result in differently rendered fonts, as you notice, since you're generating a new character which your primary font may have issues rendering.

Therefore the best solution may be to use a button, which allows arbitrary HTML content:

<button ...>C<u>a</u>ncel</button>


来源:https://stackoverflow.com/questions/35840537/how-to-underline-the-access-key-in-an-input-button

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