question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No media query for xs

See original GitHub issue

Hi There are a great mixins for media query media-breakpoint-*, but it’s not possible to build media query for xs. I tried to use media-breakpoint-between(xs, xs). In my opinion it should return:

@media (min-width: 0) and (max-width: 576px) {

but it returns:

@media (min-width: null) and (max-width: 576px) {

The problem is in breakpoint-min function:

@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
  $min: map-get($breakpoints, $name);
  @return if($min != 0, $min, null);
}

This small fix with return solves the problem:

@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
  $min: map-get($breakpoints, $name);
  @return $min;
}

So null will be returned only when breakpoint does not exists.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
robertzajdacommented, Sep 18, 2017

Yes, I did, but how about larger condition? Ex. media-breakpoint-between(xs, sm). The problem is that the function breakpoint-min never returns 0, but it shoud. Secondly something like:

media-breakpoint-between(xs, xs)

Could return:

@media (max-width: 576px) {

instead of:

@media (min-width: 0) and (max-width: 576px) {

or instead like now:

@media (min-width: null) and (max-width: 576px) {

null should be never returned becouse it’s not correct css value in this case.

0reactions
mdocommented, Oct 3, 2017

#23997 merged, so closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview - Bootstrap
Bootstrap primarily uses the following media query ranges—or ... No media query necessary for xs breakpoint as it's effectively `@media (min-width: 0) {...
Read more >
Twitter Bootstrap 3: how to use media queries? - Stack Overflow
I.e. you would first code the XS size and then have these media overrides ... less than 576px) // No media query for...
Read more >
What are media queries in Bootstrap 4? - Educative.io
Media queries are a CSS feature that enables the content of a website to adapt to different screen sizes and resolutions, thus customizing...
Read more >
Flexible layouts without media queries - LogRocket Blog
The problem with media queries is that they don't play well with design systems, as components within said systems usually are defined with ......
Read more >
Approaches to Media Queries in Sass - CSS-Tricks
Using media queries in CSS as part of responsive websites is bread and ... Not the logic we're looking for */ @media (min-width:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found