Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Responsive HTML website

I want to make a responsive website. I know there is a @media tag for css, if I want to change css for responsiveness. How would I do the same thing for HTML? I want to make a login / register form which has completely different divs in the mobile version. How would I be able to do that?

1 Answer

One way to do this with the CSS Media queries you already know is to just set display: none at different sizes.

@media screen and (max-width: 600px) {
  div.example {
    display: none;

You just have to make sure you turn elements "off" or "on" at the correct breakpoints so you're not missing chunks of your page. Comments help with this a alot.

Hope this helps,


That makes sense, thank you!