tags:

views:

74

answers:

3

Hi,

Does anybody know if there is a way to display the text value of an button in HTML on several lines ?

I mean, if you lock the width of the button in the associated CSS and you want the text on the button to be on 2 lines for example..

Thanks in advance !

+2  A: 

You can use the <button> element, which allows for styling (and text-wrapping).

Only problem with that is that if you have multiple button elements on the same page, you will potentially run into issues with IE6 passing name/value pairs to the server incorrectly.

bigmattyh
Yes I used to use it but in fact the input is an asp:input element and has to stay like this. thanks !
Button styling is not very well supported, unfortunately. Good luck with it.
bigmattyh
A: 
<input type="button" value="line &#10; break" />
idrumgood
To extend that: <input type="button" value="line break" onclick="document.FORMNAME.submit()" />
Akoi Meexx
OK ! Exactly what I was looking for !
Argh ... correction, this doesn't work when I try to use it with an asp:Button control and passing the Text value in the codebehind ...
robertc
Thanks a lot robertc ! Tested and approved :)The equivalent is : "line " + Environment.NewLine + " break"
A: 

This worked for me (using Chrome, didn't test other browsers):

myButton.Text = "Click \r\n me";
Mr. Smith
By the way, that's C#. I assumed you're using ASP.NET since you said you use it on a asp:Button control. You can do the same thing if you're using VB instead.
Mr. Smith