1

I have create an issue list and when I add values in particular field it does not display information adequately. The column width is too small. It barely fits one or two words max. I want to widen the size of columns. Can anyone please suggest anything will really appreciate.

Many thanks

2

Try to add the below style at a content editor or script editor in your list page

For All columns within list view

<style>
.ms-vh-div
{
width : 1000px !important; // set the width as you need
}

</style>

For Specific column

<style>
.ms-vh-div [DisplayName='<Title>']
{
width : 1000px !important;
}

</style>

To get the DisplayName

click F12 to open developer tools > and check the column that you need to set its width and at DisplayName attribute get this value and put it at DisplayName above.

enter image description here

Output

enter image description here

| improve this answer | |
  • Thanks for for the solution. The first one is working perfectly 'For All columns withing listed view'. Whereas the second code is not working, I tried to put in 'Embedded code' part and change the 'display name'= the column name that I want. Can you help me in that case – Narinder Chauhan Aug 31 '16 at 8:16
  • you are welcome , so what's the column name that you need to set it's width – Mohamed El-Qassas MVP Aug 31 '16 at 8:21
  • click F12 and check the column that you need to set its width and at Display name attribute get this value and put it at display name above – Mohamed El-Qassas MVP Aug 31 '16 at 8:23
  • Thanks for the response. When I add the script it changes the column width. But when I save my list the column width change back to its original width. when I recheck the script editor it shows me this code <br><style unselectable="on"> </style>. The column name that I want to change is 'Issue'. – Narinder Chauhan Aug 31 '16 at 8:24
  • what do you mean with when I save my list ? are you mean to add new item or stop editing for your page ? also you can add this to external css file and upload it to style library then add content editor > edit web part > and set the url of the uploaded file , please don't hesitate to ask me if you need more clarification – Mohamed El-Qassas MVP Aug 31 '16 at 8:41
1

You can also use javascript instead of css:

_spBodyOnLoadFunctionNames.push("AdjustColumnWidth");

function AdjustColumnWidth(){
    $("div.ms-vh-div[DisplayName='Comment']").attr("style", "WIDTH: 400px");
    $("div.ms-vh-div[DisplayName='Status']").attr("style", "WIDTH: 110px");
    $("div.ms-vh-div[DisplayName='Title']").attr("style", "WIDTH: 75px");
}

So it is basically the same. I just wonder if one solution is better than the other?

| improve this answer | |
0
<style>
.ms-vh-div[DisplayName='Description']
{
width : 500px;
}
.ms-vh-div[DisplayName='Client']
{
width : 200px;
}
.ms-vh-div[DisplayName='Project Type']
{
width : 200px;
}
.ms-vh-div[DisplayName='Project Name']
{
width : 200px;
}

</style>
| improve this answer | |
-1

I also had trouble getting the individual column script to work too. I discovered there should be no space between div[DisplayName...

Also remove<> so the script looks like

<style>

.ms-vh-div[DisplayName='Program List']
{
width : 500px !important; // set the width as you need
}

</style>

Where "Program List" in the above is my column name, and should be changed to match your column name, and the pixel length can be adjusted to meet your needs as well.

I'm using SharePoint Server 2013.

| improve this answer | |
  • This question is specific to the Office 365 version of SharePoint so this answer provides no value if its related to SharePoint Server 2013. – Shane Courtrille Jan 11 '18 at 19:01

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.