简体   繁体   中英

Multi-line buttons in HTML

If the width of a button element isn't wide enough to contain the button text Firefox and Chrome give the button more height, IE (v7 at least) will just cut off. How can I make IE expand the height to contain the text? Ideally just using CSS.

I've tried explicitly giving IE7 a height that makes the button bigger but it still just displays one line of cut off text.

<button style="width:40px;">Some really long text that is more than 20px</button>

In the real version I'm using the ButtonGroup YUI control so can't use <input> elements.

I don't have IE7 installed, but adding a DIV inside the button works in IE6:

<button style="width:40px;"><div style="height: 100%">Some really long text that is more than 20px</div></button>

Example in action.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM