G
G
gassmonkey2016-02-19 13:13:33
css
gassmonkey, 2016-02-19 13:13:33

What is the best way to write media queries?

So, gentlemen. I decided to start optimizing the development process, and started from one of the bottlenecks - writing media queries.
It is obvious that writing them completely by hand is extremely suboptimal, so now I am doing this. I take the entire main scss file, let's say

.test{
  width: 100px;
  height: 100px;
  ...
}
and transfer it to a file, let's say 768.scss, commenting out the properties, but keeping the structure.
@media (max-width: 767px) {
   .test{
      // width: 100px;
      // height: 100px;
      ...
    }
}

Then I just uncomment the properties I need, and change them.
It's faster than writing by hand, but it still doesn't look very elegant.
What other options can you recommend? Using the capabilities of preprocessors is welcome.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kozlovskiy, 2016-02-19
@Kozlovskiy

Why move something there? Create a separate css file where you need to register media queries for different resolutions and redefine only the properties you need, and connect it.

S
sashadobrota, 2016-07-29
@sashadobrota

Look towards this plugin for postcss: https://github.com/alexandr-solovyov/postcss-respo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question