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.

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;}