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

CSS

How to Move right column below the left in smaller screen size

I have a left and right cloumn and I want the right column to shift below the other when the screen gets smaller

1 Answer

Hey Erica,

The best way to do this is to just set each column to display: block; so that they will stack on top of each other using a media query that targets at or below a certain screen size. For example,

/* Target screens from 699px width and lower */
@media screen and (max-width: 699px) {
  .col-1 {
    display: block;
  }
  .col-2 {
    display: block;
  }
}

so this is what I have written for just normal viewing but when I plugin the CSS you have written it does nothing. I need the "right" to be positioned below the "left and I need "truck" to be positioned below "personnel".

.table { position: relative; border-bottom:15px solid #B22E1B; background-color:#DADADA; margin-top:30px; margin-bottom:0; padding:20px; overflow:hidden; } .left { float: left; width:50%; } .right { float: right; width:50%; }

ul.style1 li { text-align: left; text-indent:-10px; margin-left:10px; margin-top: 20px; padding-right:5px; padding-left:5px; }

.table-1 { position: relative; width:100%; overflow:hidden; margin-bottom:50px; color: #B22E1B; }

personnel { float:left; width:40%; text-align: left; color: #B22E1B; margin-top: 20px;}

.truck { width:60%; float: right;}