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

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!


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.

Karsten Schneider
About Karsten Schneider 302 Articles
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.