bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

How tables should be handled on different screen sizes?

Open jeserkin opened this issue 14 years ago • 8 comments

Yesterday, I tried to resize Chrome browser window in width, but table haven't changed in any way. Is it possible, to somehow modify table presentation for different screen sizes? Maybe there is some upcoming plugin for that or maybe it can be achieved with plain CSS. I'm not a designer, therefore I can't say for sure, what approach would be better. But I gues it is duable.

jeserkin avatar Mar 14 '12 09:03 jeserkin

This is what you might be looking for http://css-tricks.com/responsive-data-table-roundup/

I am working on something like this in combination with bootstrap

sannefoltz avatar Mar 14 '12 12:03 sannefoltz

Put your tables inside of a "row-fluid" and watch it shrink in width. To achieve more customization (font-size, layout, etc.), you'll have to create your own CSS to handle that.

BenjiZombie avatar Mar 14 '12 12:03 BenjiZombie

@sannefoltz yes, exactly that. I see that as an only solution for viewing on devices with smaller screen size if you don't want to scroll.

@BenjiZombie so it can be handled just with CSS ( no Javascript needed for that ). Okey. So maybe it is worth placing it in bootstrap? Sure I can do it ( probably ) myself, but since it is a bootstrap and it allows to work with different screen sizes, it should be compatible with all that is purposed already ( tables included ).

jeserkin avatar Mar 14 '12 12:03 jeserkin

Problem is, you could have different types of content in a table (images, controls, iframes, etc.) and not only text, so creating a general responsive design would be difficult IMO. But if it's only text, than sannefoltz's solution might be the way to go.

BenjiZombie avatar Mar 14 '12 13:03 BenjiZombie

I think, that it should be done mainly for text and if there should be anything else, then user of bootstrap will be responsible for implementing it for anything else. At least, that is what I think.

jeserkin avatar Mar 14 '12 13:03 jeserkin

Customizing tables to be responsive has been proposed before, but I've yet to see an elegant solution that works uniformly. In some cases, not all content is appropriate for every device and resolution—tables are a grab-bag and if you look through the BS docs on your phone, you'll see why.

We won't be adding anything to the BS core for this.

mdo avatar Mar 15 '12 02:03 mdo

I'm doing so:

.table {
td, th { word-wrap: break-word !important; word-break: break-all !important; } }

I know that this is ugly, but it works.

:dancers:

amoroz avatar Jun 20 '14 16:06 amoroz

Nowadays, there's .table-responsive, which adds horizontal scrolling but doesn't fundamentally alter the formatting of the table.

cvrebert avatar Jun 20 '14 16:06 cvrebert