Forum Discussion
Tammy Bruns
Nov 11, 2019Copper Contributor
Column Width in Sharepoint List
I have a modern site that has a column for state which is abbreviated i.e. IL, MT, FL but I cannot get the column width to decrease. I am using Sharepoint Online. Can anyone help me with decreasing t...
Tammy Bruns
Nov 13, 2019Copper Contributor
Can anyone please assist?
Norman Young
Nov 14, 2019MVP
Hi Tammy Bruns,
You can use JSON column formatting. You may want to decrease (rename) the column name width as well (manually). Example below:
Sample JSON code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"width": "50px"
}
}
I hope this helps.
Norm
- VincentElementsFeb 12, 2021Copper ContributorHi Norm. I tried using your code on a SharePoint classic column, but it did not increase the width if I chose e.g. 200px
Please note my column is a rich text field:
Column name:
The type of information in this column is:
Multiple lines of text - Tammy BrunsNov 15, 2019Copper Contributor
Norman Young Thank you but that does not allow me to move the column slider (Header) to decrease it. That does decrease the acutal column size but the the column visually stays the same. I would like to be able to move the slider (highlighted in picture) so that it decreases the column. Is there a JSON that would accomplish that?
- LabDude09Nov 17, 2019Copper ContributorI had been looking into this a while back, and the best information I had found, was describing how to use a web part and java script to accomplish this. I was unable to follow it through as I don't have the right permission levels and had since given up on trying. I still believe that this is probably the only option at the moment. It involved downloading a piece of java script, uploading to the SharePoint site assets, then adding a web part. It didn't look overly complicated. If I manage to find the website that I was looking at, I will put more info in here
- Norman YoungNov 16, 2019MVP
Hi Tammy Bruns,
I have not seen any code examples that will do that. It might be possible but I can't say for sure.
I hope this helps.
Norm