function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sherry CusickSherry Cusick 

Insert Line Break to VisualForce page

How do I insert a Line break to a visualforce page?

I've tried <br/> /p \n /n

I'm also using apex:outputPanel in our decision letter and haven't found a way to insert some breaks.
VinayVinay (Salesforce Developers) 
Hi Sherry,

Workaround is you may use PRE tags, or <apex:outputField> instead of <apex:outputText>.  Check below references.

https://help.salesforce.com/s/articleView?id=000336280&type=1
https://salesforce.stackexchange.com/questions/185256/apex-new-line-in-conditional

Else you can use something like below.

Controller:
public class SFController{  
    public String myVariable {get;set;}  
    public SFController(){  
        myVariable = 'Sales Cloud' + '\n' + 'Service Cloud' + '\n' + 'Community Cloud';  
    }  
}

VF:
<apex:page controller="SFController">   
    <apex:outputLabel value="{!SUBSTITUTE(JSENCODE(myVariable), '\\n', '<br/>')}" escape="false"/ >   
</apex:page>

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Suraj Tripathi 47Suraj Tripathi 47
Hi Sherry Cusick,
can you describe your question , I am not understanding clearly.
Basically you can use <br/> in your page, it gives you  a line break
you can get help from this help page:
https://help.salesforce.com/s/articleView?id=000336280&type=1 (https://help.salesforce.com/s/articleView?id=000336280&type=1)
you can learn from this:
https://salesforce.stackexchange.com/questions/174409/line-break-in-visualforce-page (https://help.salesforce.com/s/articleView?id=000336280&type=1)

If you find your Solution then mark this as the best answer.

Thank you!
Regards,
Suraj Tripathi