Sign in
Log inSign up

How do you structure your media queries?

Ozzie Neher's photo
Ozzie Neher
·Nov 3, 2016

Specifically when you're using a preprocessor.

These are two common ways I've personally done it. How are you doing it?

.foo {
    width: 100%;
}

.bar {
    border-color: red;
}

@media screen and (min-width: 768px) {
    .foo {
        width: 50%;
    }
    .bar {
       border-color: green;
    }
}

and

.foo {
    width: 100%;

    @media screen and (min-width: 768px) {
        width: 50%;
    }
}
Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct