Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In a document library, I have documents grouped by two columns. I would like the view to have less spaces between the group by categories (see attached screenshot). I'd like the space between the lines "folder" and "Document Identifier" and "Document Identifier" to be less.

This is a job situation where we don't have access to SharePoint Designer. I assume this is cell padding or paragraph or div tags.

Is there any code that I can add to a Content Editor web part to fix this style?!

enter image description here

share|improve this question
add comment

1 Answer

Create a new document library, so the following does not mess up your structure. Don't show the new document library on the Quick Launch or Navigation. Create a text file and upload it to the document library.

The text file will contain the CSS styles required to make the spaces between the rows smaller.

To find out what styles are involved, use the Developer Tools of Internet Explorer by hitting F12. Click the Arrow icon and then click one of the rows in the List view. Try out a few clicks until you see the blue border around the group title. In the screenshot, this can be seen in the background. The window on top is the Developer Tools window. Select the "Trace Styles" tab and study the CSS styles applied.

enter image description here

In this example the top padding is set to 14 px by the styles .ms-listviewtable and .ms-gb

You can click the padding value and change it to another number. This will reflect instantly on the web page in the background. This way you can try out other values for the CSS style.

Once you have found the value you want, you can use it in the text file created above.

Open the text file and enter something along these lines:

<style type="text/css">
.ms-listviewtable .ms-gb {
    padding-top: 0px;
}

</style> 

Add other styles as required before the closing style tag. Close the Developer Tools window. Save the text file back to the SharePoint Library. In the list view of the library, right-click the text file and copy its URL.

Edit the page with the list view and add a Content Editor Web Part below the list view. Edit the CEWP and in the Content Link box enter the URL to the text file.

enter image description here

Save the page. The list view will now show with the custom CSS applied via the text file.

To change any other CSS aspect of the page, all you need to do is add the desired CSS class to the text file, save it and refresh the page.

Ideally, this text file should be saved in the Site Collection's Style Library. Everyone who can access a sub site also has limited read access to this library, files can be version controlled (roll back changes), and can also be applied to all sites in the site collection. Also, storing it in the site collection Style Library protects it from accidental deletion by a user with Contribute permissions to the sub site.

No SharePoint Designer needed!!

share|improve this answer
    
Thank you. I don't need to hide the style text file, so I am just placing the text directly into the content editor web part rather than linking. When I go into the F12 developer, I don't see any choices for Style:Tracing. There is nothing there. Should I go into the CSS tab? If I change a setting, I am supposed to see the changes immediately on my web page. It doesn't matter if I am in page edit mode or do I have to be in Edit mode? –  Tommy Jul 19 '13 at 15:58
    
Thank you. i have the whole thing working. You are terrific! –  Tommy Jul 19 '13 at 19:33
    
If my suggestion has helped, please mark it as the answer, so people can see that there is a solution. –  teylyn Jul 19 '13 at 22:15
    
I don't know how to mark it as answered. –  Tommy Jul 24 '13 at 15:49
    
There is a check mark next to each answer. Click it to toggle it from grey to filled in. Have a look through the help about using the site, especially: sharepoint.stackexchange.com/help/someone-answers –  teylyn Jul 24 '13 at 21:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.