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 trialArthur Kakulidis
2,657 PointsResponsive 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
Dylan Glover
2,537 PointsOne 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,
Dylan
Arthur Kakulidis
2,657 PointsArthur Kakulidis
2,657 PointsThat makes sense, thank you!