Skip to Content

tablet()

A shortcut for tablet media queries.

Sass February 22, 2017

Usage

Sass
tablet($orientation)

Parameters

$orientation
(Optional) (String) The device orientation
Default: "portrait"

Parameter Notes

“portrait” triggers at 767px and smaller.

“landscape” triggers at 1023px and smaller.

Request or provide clarification »

Examples

Sass
.element {@include tablet(){background: red;};}
Sass
.element {@include tablet(landscape){background: purple;};}

Source File

Located in /assets/scss/partials/_mixins.scss on line 147.

Sass
@mixin tablet($orientation: "portrait"){
    @if $orientation == "landscape" {
        @media only screen and (max-width: 1023px){& {@content}} //This size and smaller
    } @else {
        @media only screen and (max-width: #{$md - 1}px){& {@content}} //This size and smaller
    }
}

Override

To override or disable this, redefine the mixin/function later on, or use different class names to prevent this from targeting your element.

Sass
@mixin tablet($orientation){
    //Write your own code here, leave it blank, or return false.
}