+ Start a Discussion
Manpreet Singh 13Manpreet Singh 13 

how to reduce the width of text on visualforce page

Hello All,

How can i reduce the width of my output text. It is a standard Comments (Text) field from Tasks. Any inputs/pointers will be appreciated

Here is the code

for(Task task: gettask())
{
    CommonContainer cc=new CommonContainer();
    cc.createdDate=task.CreatedDate;
    cc.content=
    '</br>*****<h1>Tasks and Activities</h1>*****' +
    '</br></br>' +
    '<tr align="left"><b>Assigned: </b></tr>' + task.Owner.name + '</br></br>' +
    '<tr align="left"><b>Created By: </b></tr>' + task.CreatedBy.name + '</br></br>'+
    '<tr align="left"><b>Status: </b></tr>' + task.Status + '</br></br>'+
    '<tr align="left"><b>Priority: </b></tr>' + task.Priority + '</br></br>'+
    '<tr align="left"><b>Due Date: </b></tr>' + task.ActivityDate + '</br></br>'+
    '<tr align="left"><b>Subject: </b></tr>' + task.Subject + '</br></br>' +
    '<tr align="left"><b>Description/Comment: </b></tr>' + task.Description +'</br>';
     containerList.add(cc); 
}

Here is the output of the code, you can see text is spread across the page. I want it to be little compact (probably half the current size)

User-added image
Best Answer chosen by Manpreet Singh 13
surasura
hi I coudnt get the style property of output text working for some reson but this worked 
 
<div style="word-wrap:break-word; width:100px;" >
     <apex:outputText value="ssssssssssssssssssssssssssssssssssssssssssssss"   ></apex:outputText>
     </div>

make this the best answere if this helps

All Answers

surasura
you can use the style or styleClass attributes of apex:outputtext to format the width of your outputtext 
Manpreet Singh 13Manpreet Singh 13
Thank you sura. Would you mind if i ask for sample code.

Best,
Manpreet Singh
surasura
hi I coudnt get the style property of output text working for some reson but this worked 
 
<div style="word-wrap:break-word; width:100px;" >
     <apex:outputText value="ssssssssssssssssssssssssssssssssssssssssssssss"   ></apex:outputText>
     </div>

make this the best answere if this helps
This was selected as the best answer
Manpreet Singh 13Manpreet Singh 13
Hello Sura, Thank you for the sample code. It worked!