简体   繁体   English

HTML中的多行按钮

[英]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. 如果按钮元素的宽度不足以容纳按钮文本,则Firefox和Chrome会为按钮提供更高的高度,IE(至少v7)会被截断。 How can I make IE expand the height to contain the text? 如何使IE扩展高度以包含文本? Ideally just using CSS. 理想情况下,仅使用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. 我已经尝试过明确给IE7一个高度,该高度可以使按钮更大,但它仍只显示一行切除的文本。

<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. 在实际版本中,我使用的是ButtonGroup YUI控件,因此不能使用<input>元素。

I don't have IE7 installed, but adding a DIV inside the button works in IE6: 我没有安装IE7,但在IE6中可以在按钮内添加DIV

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

Example in action. 实际的例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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