开发者

Muli-line button in IE

I'm currently in a horrible situation that r开发者_运维知识库equires me to style an input of type "button" over two lines. Having a fixed width on the button causes the text within the button to wrap onto two lines in all other browsers except IE.

My question is therefore, how do I specify that an input with value="Button to Wrap" wraps onto two lines in IE?

I'm willing to accept any hacks or workarounds to make this happen.

Much appreciated!


Use the button element instead - it can contain other markup:

<button type="button">
First Line<br />
Second Line<br />
Third Line<br />
</button>


What works for me is to set CSS white-space to pre-line of the button input with a fixed width.

But only the first line will be visible on the button input. So height must be set to a fixed value or to auto.


Have you tried hard returns in your source code? Works for me...

<p>
<input type='button' value='3
Line
Button'
/>
</p>


The word-wrap CSS attribute seems to be the word on this one. If that doesn't work, you'll have to try using a div tag style to look like a button and an onClick handler...

<input type=button value="test" style="word-wrap: break-word"></input>

This might need position, height and width attributes as well to work.


Have you tried using br tags?


What works for me is to add a child span to the button, set its display to block and limit its width as the button's is.

It only affects IE 8 and 9 when the document is in IE7 mode.


Why not to use image button? Make image for button, and pressed button... Or make button in flash (:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜