-
Notifications
You must be signed in to change notification settings - Fork 143
Respond To
Snugug edited this page Apr 26, 2013
·
6 revisions
Breakpoint now includes the alternative Respond-to syntax which provides for slightly more semantic reading of your media queries when used. There's nothing additional you need to import, and it supports all of the features of standard Breakpoint. Usage is simple; using the $breakpoints
variable, set a string name and associated breakpoint query, and then call respond-to
instead of breakpoint
.
// We can use all of the Breakpoint control variables with respond-to as well!
$breakpoint-no-query-fallbacks: true;
$breakpoint-to-ems: true;
// These numbers were chosen at random. Don't look too far into them.
$breakpoints: 'one column to two columns' 456px,
'between medium and large' (876px 1324px, 'no-query' '.no-mq'),
'high resolution' (min-resolution 1.5dppx),
'handheld device or landscape' (handheld, orientation landscape);
#foo {
@include respond-to('one column to two columns') {
content: "Now it's two columns!";
}
@include respond-to('between medium and large') {
content: 'This is between a medium and large size';
}
@include respond-to('high resolution') {
content: 'This has a fairly high resolution';
}
@include respond-to('handheld device or landscape') {
content: "Handheld device, or maybe it's in landscape";
}
}
@media (min-width: 28.5em) {
#foo {
content: "Now it's two columns!";
}
}
@media (min-width: 54.75em) and (max-width: 82.75em) {
#foo {
content: 'This is between a medium and large size';
}
}
.no-mq #foo {
content: 'This is between a medium and large size';
}
@media (min-resolution: 1.5dppx), (-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
#foo {
content: 'This has a fairly high resolution';
}
}
@media handheld, (orientation: landscape) {
#foo {
content: "Handheld device, or maybe it's in landscape";
}
}