locked
Fixed Column Header Width in Document Library RRS feed

  • Question

  • Hello,

    I have a SharePoint site set up strictly for file sharing via document libraries. I have many document libraries set up on the homepage, but the problem I am seeing is that the column headers on each document library are not set at a fixed width, so it looks very messy. 

    Each document library has the same columns, so therefor should have the same width for each column header.

    I have tried modifying CSS code with script editors and also tried jquery methods, but to no avail. It seems that the only things I have found on the web are to change the actual column width, and not the column header width. 

    Is there a way to set a fixed width on document library column headers?


    Nick Townsend Infrastructure Technician

    Wednesday, February 10, 2016 1:56 PM

Answers

  • Hi ntownx5,

    According to your description, you want to adjust the width of the columns.

    I don’t think it’s possible to adjust the column header width. We adjust the actual column width in general using Jquery/CSS.

    Please refer to the steps below:
    1.Create a .txt file, then copy and paste the code below.
    2.Upload the file to SharePoint library and copy the path url to the file.
    3.Navigate to the list, click Edit Page under settings icon beside your account.
    4.Add a web part > Categories: Media and Content > Parts: Content Editor
    5.Edit content editor web part, type the url in step 2 into Content Link, click OK.
    6.Under Page tab, click Stop Editing.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
    
                    <script type="text/javascript">
    
                    $(document).ready(function() {
    
                    $("TH.ms-vh2:contains('Title')").css("width", "300px"); //I suppose you would test on Title column with 300px. If you would like to modify another column, replace “Title” with words in column name. 
    
    });
    
                    </script>

    Please refer to the link:
    http://www.emmielewis.com/changesplistcolumnwidth/

    Best Regards,

    CY


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, February 11, 2016 3:15 AM