How can I wrap button text in Opera?

二次信任 提交于 2019-12-11 15:47:48

问题


I have almost created a website that works in all major browsers flawlessly. Yesterday, I celebrated because that was true. Today, I found out that it is not.

Apparently, Opera won't wrap text on buttons. I tried everything that popped up in my searches - from spacing to outdated Mozilla Firefox hacks.

How can I tell Opera to wrap text on a button? Shortening the text is not an option, as the shortest it could be is still too long.

EDIT:

Here is a JSFiddle: http://jsfiddle.net/JavaAndCSharp/grX4H/


回答1:


Uhm, yes it does? I didn't even do anything other than define the width of the button. I'd suggest that you have conflicting CSS.

http://jsfiddle.net/Qgdzx/

HTML:

<button>This is really long button text that should wrap after I define a fixed-width.</button>

CSS:

button{
    width:60px;
}

Output:


Edit after your update http://jsfiddle.net/CJbae/

HTML:

<form>
    <button id="littleWorld" type="button">really really long text that will probably overflow on opera</button> 
</form>

CSS:

#littleWorld{
    border-radius:40px;
    border-width:0px;
    width:250px;
    height:250px; 
    background-color:#808080;
    font-family:Arial, Helvetica, sans-serif;
    font-size:11px;
    font-weight:bold;
    color:#FFFFFF; 
}




回答2:


This is indeed a known issue in Opera, where more text formatting will be applied to BUTTON elements than to INPUT type=button. They should be equivalent, really.

I hope using BUTTON instead of INPUT type="button" is an acceptable workaround for you (fingers crossed - BUTTON might cause other rendering problems in other browsers..)

Seems Opera already has a bug on this - internally it's CORE-45335.



来源:https://stackoverflow.com/questions/9871121/how-can-i-wrap-button-text-in-opera

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