Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make responsive table [closed]

I have a table to represent some data in my html page. I'm trying to make this table as responsive. How can I do this?

Here is the Demo.

like image 804
Bishan Avatar asked Aug 26 '13 04:08

Bishan


People also ask

How do I make a table row responsive in HTML?

You can just wrap your <table> tag inside of <div class="table-responsive"></div> since you're using bootstrap. Just like this: (use <table> instead of grid system (e.g. col-xs-1 etc.)) .. That's it!

How do you make a table responsive in css3?

The primary method of making a responsive table is to add a class table table-responsive inside the table tag. To make a table responsive, we wrap the whole table inside a container tag like div with property overflow-x equals to auto .

How do you stop a table from expanding?

To prevent cells (rows) from expanding vertically, you have to set a fixed height for table rows. Select the relevant rows and, on the Table Tools Layout tab, click Properties. On the Row tab, select "Specify height" and then choose "Exactly" for "Row height is." Specify the desired amount.


2 Answers

Basically

A responsive table is simply a 100% width table.

You can just set up your table with this CSS:

.table { width: 100%; } 

Demo here

You can use media queries to show/hide/manipulate columns according to the screens dimensions by adding a class (or targeting using nth-child, etc):

@media screen and (max-width: 320px) {     .hide { display: none; } } 

HTML

<td class="hide">Not important</td> 

More advanced solutions

If you have a table with a lot of data and you would like to make it readable on small screen devices there are many other solutions:

  • css-tricks.com offers up this article for handling large data tables.
  • Zurb also ran into this issue and solved it using javascript.
  • Footables is a great jQuery plugin that also helps you out with this issue.
  • As posted by Elvin Arzumanoğlu this is a great list of examples.
like image 99
hitautodestruct Avatar answered Oct 22 '22 20:10

hitautodestruct


Check the below links for responsive table:

http://css-tricks.com/responsive-data-tables/

http://zurb.com/playground/responsive-tables

http://zurb.com/playground/projects/responsive-tables/index.html

like image 23
Swarnamayee Mallia Avatar answered Oct 22 '22 19:10

Swarnamayee Mallia