Sometimes, we want to make a Bootstrap table column fit to content with CSS.
In this article, we’ll look at how to make a Bootstrap table column fit to content with CSS.
How to make a Bootstrap table column fit to content with CSS?
To make a Bootstrap table column fit to content with CSS, to set the white-space property.
For instance, we write
.table td.fit,
.table th.fit {
white-space: nowrap;
width: 1%;
}
to add white-space: nowrap;
to stopo the td and th’s contents from wrapping.
We set the width so the content is truncated when it overflows.
Conclusion
To make a Bootstrap table column fit to content with CSS, to set the white-space property.