Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Jeanie Herold](https://uploads.teamtreehouse.com/production/profile-photos/5946852/micro_self-portrait222.jpg)
Jeanie Herold
15,555 PointsHTML Tables Course
I am curious. I just finished HTML Tables Course:
I started to play with the css and thought for sure changing the max-width: 960px;
to max-width: 80%;
would make the table responsive at mobile size -->
table {
max-width: 80%;
margin: 10px auto;
}
But it didn't. Which table element should be targeted to make the table responsive? Or should the table be placed inside a <div>
and then set the div to a width of 80% for best practice syntax?
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYour style as shown might make a table responsive, depending on the contents. If it were filled with text that can wrap, it would indeed cause the columns to narrow as the window became smaller.
On the other hand, it it is filled with objects of fixed size (images, perhaps), it may seem that nothing is happening. A table cannot become smaller than its contents. In that case, you would have to scale the images themselves, and the table would happily shrink around them without requiring any explicit styling itself.
![Mitchell Fargher](https://uploads.teamtreehouse.com/production/profile-photos/5919372/micro_image.jpg)
Mitchell Fargher
11,634 PointsYou can do some pretty neat things with flexbox using flex-wrap to make tables responsive as well.
![Jeanie Herold](https://uploads.teamtreehouse.com/production/profile-photos/5946852/micro_self-portrait222.jpg)
Jeanie Herold
15,555 PointsHi Mitchell, I am not yet familiar with flexbox. I will look that up.
Thank you for the reply!
Jeanie Herold
15,555 PointsJeanie Herold
15,555 PointsHi Steven,
It was just text in the cells (no object otherwise) but at mobile size it stopped being responsive.
I cant see anything in the css file that would be overwriting or blocking the code at mobile size. This was project files from the HTML Tables course. So it is not important that I make this responsive. BUT it is bugging me that I cannot see what is keeping it from being responsive at mobile. Unless the padding and margins in pixels are too high for mobile to stay within the 80%. It was curious. I will play with that some more to test it. Thank you for replying