Adjust the column width on a webpart

Diana Weaver 120 Reputation points
2023-08-31T13:09:30.7933333+00:00

Is there a way to modify an individual column width in a webpart display of a list?

User's image

We are trying to increase the title column and decrease the URL column.

Diana

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,598 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Emily Du-MSFT 45,991 Reputation points Microsoft Vendor
    2023-09-01T02:05:09.8833333+00:00

    Here is an example for you:

    1.Click Edit page in the Settings gear.

    2.Add a web part, choose Script Editor web part.

    3.Edit web part, then click EDIT SNIPPET, add following codes. Note: You should replace the column display name with your own.

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

    4.Result:

    1


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Claire Hoe 0 Reputation points
    2024-06-04T16:43:14.53+00:00

    Is working brilliantly for me! Thank you

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.