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 Modular CSS with Sass Modular Media Queries Creating Element States

Markus Mönch
Markus Mönch
16,383 Points

How do I make 3point views?

Can someone show me how to make three columns or 3

So there is a mobile, tablet, desktop?

With 1-2, 1-3 1-4 etc.. ? please

1 Answer

I would be happy to help, but first how would you go about doing it? By knowing how you would go about solving this problem, its easier to walk through the problem and learn.

Markus Mönch
Markus Mönch
16,383 Points

That's the grid system, I want to put in Sass, but I'm not sure how to do it, as it wasn't in the tutorial. He showed only how to do the grid system, but it isn't resposnive.

// ==========================================================================
// Grid System
// ==========================================================================
.l-grid {
  position: relative;
}

.l-grid,
.l-grid:before, 
.l-grid:after {
    content:"";
    display: table ;
    clear:both;    
    width: 100%;
}


.col {
   position: relative;
    min-height: 1px;
    padding-left: 15px;
    padding-right: 15px;
    float: left;
}

.col-np {
  position: relative;
  min-height: 1px;
  float: left;
}

//All

.all-1 {
  width: 100%;
}

.all-1-2 {
  width: 50%;
}

.all-1-3 {
  width: 33.3333%;
}

//Extra Small

@include mq(xs-only) {

  .xs-1 {
    width: 100%;
  }

  .xs-1-2 {
    width: 50%;
  }

  .xs-1-3 {
    width: 33.3333%;
  }

  .xs-2-3 {
    width: 66.6666%;
  }

  .xs-1-4 {
    width: 25%;
  }

}

//Small

@include mq(small) {

  .small-1 {
    width: 100%;
  }

  .small-1-2 {
    width: 50%;
  }

  .small-1-3 {
    width: 33.3333%
  }

  .small-2-3 {
    width: 66.6666%
  }

  .small-1-4 {
    width: 25%
  }

}

//Tablet

@include mq(medium) {

  .medium-1 {
    width: 100%;
  }

  .medium-1-2 {
    width: 50%;
  }

  .medium-1-3 {
    width: 33.3333%
  }

  .medium-2-3 {
    width: 66.66666%;
  }

  .medium-3-4 {
    width: 75%;
  }

  .medium-1-4 {
    width: 25%
  }

  .medium-1-5 {
    width: 20%;
  }

}

//Desktop

@include mq(large-up) {

  .large-1 {
    width: 100%;
  }

  .large-1-2 {
    width: 50%;
  }

  .large-1-3 {
    width: 33.3333%
  }

  .large-2-3 {
    width: 66.6666%;
  }

  .large-1-4 {
    width: 25%;
  }
  .large-3-4 {
    width: 75%;
  }
  .large-4-5 {
    width: 80%;
  }

  .large-1-5 {
    width: 20%;
  }

  .large-3-10 {
    width: 30%;
  }

  .large-7-10 {
    width: 70%;
  }

}

// $breakpoints: (
//   small: 450px,
//   medium: 650px,
//   large: 850px
// );


// .l-grid {
// //   Variables
//   $gutter: 20px;

// //   Container
//   margin: ($gutter / -2);

// //   Clearfix
//   &::after,
//   &::before {
//     content: "";
//     display: table;
//     clear: both;
//   }

//   &::after {
//     clear: both;
//   }

// //   Grid
//   @at-root {
//     [class^="l-grid__"] {
//       float: left;
//       padding: 0 ($gutter / 2);
//       margin-top: ($gutter / 2);
//       margin-bottom: ($gutter / 2);
//     }
//   }

//   &--reverse > [class^="l-grid__"] {
//     float: right;
//   }

//   @for $number from 1 through 12 {
//     &__#{$number} {
//       width: percentage($number / 12);
//     }
//   }

//   @each $name, $size in $breakpoints {
//     @media (min-width: $size) {
//       @for $number from 1 through 12 {
//         &__#{$number}--#{$name} {
//           width: percentage($number / 12);
//         }
//       }
//     }
//   }

//   @for $number from 1 through 11 {
//     &__offset-#{$number} {
//       margin-left: percentage($number / 12);
//     }
//   }

//   @each $name, $size in $breakpoints {
//     @media (min-width: $size) {
//       @for $number from 1 through 11 {
//         &__offset-#{$number}--#{$name} {
//           margin-left: percentage($number / 12);
//         }
//       }
//     }
//   }
// }