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
kat Free
1,143 PointsHow can I get my 2 divs to show? I would like have one show when desktop screen size and one on mobile screen size.
Created a Responsive Flat Ui Project and need assistance with How can I get my 2 divs to show? I would like have one show when desktop screen size and one on mobile screen size.
2 Answers
Matthew Greenberg
8,173 PointsYou can you the css display property to hide and show divs
#div1 {
display: block:
}
#div2 {
display: none;
}
/* NOW WE SWITCH DISPLAY MODES AT SMALL VIEW-PORTS */
@media screen and (max-width: 480px) {
#div1{
display: none;
}
#div2{
display: block;
}
}
div1 and #div2 are your id names for your divs.
Hope this helps.
kat Free
1,143 PointsThank you this worked!!!! :)