I have a problem that has to do with aesthetics of a list that I'm developing for one of our departments. I'm trying to figure out how to set my column widths so that if text is small, it shrinks the cell to my min width value. If my text is larger than that, I want the column to expand out to my max width value, and then wrap.

I have gotten the cells to expand out simply by using Javascript (in a script editor web part) to remove the width value, but the line will always wrap at the first space in the entry (for example, putting the city Des Moines on 2 lines).

I have tried multiple solutions, with nothing to show for it. Anyone have any ideas?


2 Answers 2


I use this (in a CSS definition that overrides the default CSS)

Not perfect, but no CEWPs and JavaScript required.

/* ListView - make Description fields a maximum width and height, and show full text on mouseover*/
/*.ms-itmhover is the TR row*/
.ms-vb2  .ms-rtestate-field{
.ms-vb2  .ms-rtestate-field:hover{

And since you have extra CSS, you can also add

/* ViewEdit page; add alternating colors to columns list and Totals*/
#tbodyViewColumns tbody tr:nth-child(odd){
    background-color:rgba(205, 230, 247, 0.5);

Go edit a View and you see these 3 lines is a time-saver

  • 1
    Thanks...I figured that out last night...I was desperate trying to get java script to change the CSS properties, and then it occurred to me to just put in the changed CSS INSTEAD of the java script. Good answer. Commented Sep 18, 2015 at 16:04

The above answer works great, but I also wanted to add this relevant piece of information I figured out.

In addition to that answer, if you want the text to start small, expand to a max width value and then wrap, you do the following CSS:

<style type="text/css"> 
             padding: 4px 8px 4px 8px

After you do that, you change the fields that you want to wrap to multi line text. Now, my text box will start at normal width. It can expand up to 250 px, and if it goes over that it will wrap the text to the next line. Obviously, this won't work in every instance, but it worked great for my needs. The reason this works with a multi line column and not a single line:

In order for a column with normal text in it to push a cell out to it's max value, it either needs to have a no wrap attribute (such as white-space:nowrap;) applied, or be contained within another element. When you add text to a single line column, it just adds your text to the cell without any additional elements. A multi line column, on the other hand, places your text within a <p> element. This allows the cell to expand to it's max value and then wrap the text.

EDIT the padding tag is unnecessary, I just wanted a little more space between my entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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