I am trying to get a line break so the result would be like normal text just changing a line not paragraph.

I am using
and but I still get spaces like a paragraph between my lines. A snippet of my code is :

<br>Tel :&nbsp;{!$User.Phone}</br>
<br>Fax :&nbsp;{!$User.Fax}</br>
<br>Email :&nbsp;{!$User.Email}</br>

and the outcome is spaces between the lines

Any ideas how to overcome this?

  • Hi Tommy , any CSS applied to the top of this page. Also are you using <br> in your code. ? – Amit Bangad Nov 24 '14 at 7:26
  • Tommy can you explain why you feel this issue is related to Visualforce . Pure HTML questions are out of scope here and better asked at stackoverflow.com (the origine of all stackexchange sites). There are many more html,css or javascript pro's there than there are here. – Samuel De Rycke Nov 24 '14 at 15:54
  • Thank you all for your comments. Do solved the issue by scoping around through HTML. – Tommy Georgiou Nov 25 '14 at 9:15

The <br> tag is an empty tag, which means it doesn't have an end tag. A single <br> tag represents a single line break.

What you're doing by adding opening and 'closing' tags like you have is creating 2 line breaks instead.

The following should achieve what you want:

Tel :&nbsp;{!$User.Phone}<br/>
Fax :&nbsp;{!$User.Fax}<br/>
Email :&nbsp;{!$User.Email}<br/>
| improve this answer | |

Is your code inside a page block? perhaps the page block is adding some style to it?

In any case, instead of relying on <br/> tags, perhaps you could wrap your different lines inside outputpanels which will render as divs. And then to customize it further, you can apply CSS to those panels/divs.

<apex:outputPanel layout="block">
<apex:outputPanel layout="block">
<apex:outputPanel layout="block">
| improve this answer | |

Note- If you are trying to use a object with line breaks in it-in a visual force email template do this:

<apex:outputField value="{!object}"/>

This will translate any line breaks in the object into the visual force email template.

| improve this answer | |

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.