1

How would you format the following such that the button displayed on two lines?

<apex:commandButton value="First line \n Second line">
1
  • Dont know apex:command work or not but you can try this <button type="submit">My<br />Button</button>
    – Ratan Paul
    Mar 3 '16 at 7:36
1

You would have to play around with the CSS to achieve this. You would need to use the width, word-wrap properties and add/remove spaces depending upon the word you want to fit in the button.

Below is what i tried in my developer org and achieved the result you expected.

<apex:commandButton value="  First line  Second line" style="width: 70px; word-wrap: break-word;"/>

enter image description here

0

I think apex does not support this. You have one workaround that use

 <button OnClick="myFun();">multiline<br/>button<br/>text</button>
 <script>
   function myFun(){
        //alert('hi');
        //CALL YOUR ACTION FUNCTION HERE 
   }
 </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.