SharePoint 2010 Word wrapping in Listviews or Dataviews Table Headers

So whatever the customer desires we do our best to create nice, useful and powerful applications based on SharePoint – and that can be a challenge. But sometimes it’s just nice to use some small scripts which can make your work so much easier. So did you ever wanted to make the heading of a listview or a dataview breaking into two lines? So you can go into SharePoint Designer and change the css attributes foreach table column or you simply use the css of SharePoint. If you add a content editor webpart below your listview or dataview webpart and simply add the following script into the html source:


<style type= "text/css">
.ms-vh, .ms-vh2-nograd, .ms-vh2, .ms-vb
{
white-space: normal
}
</style>

It works like charm and your column header text will be displayed in two lines.

If it does not work you have to figure out, which css class the column uses which does not wrap the words. I basically got the information from Ryan’s post. Thanks to Ryan!

..:: I LIKE SHAREPOINT ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.



About Karsten Schneider 308 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.