G
G
Giterman2018-07-13 10:36:32
css
Giterman, 2018-07-13 10:36:32

Mobile First or style separation?

Hello!
I would like to ask more experienced developers which method of adaptive layout is preferable to use:
Mobile first

.text {
  font-size: 12px;
  color: #222;
}

@media (min-width: 768px) {
  .text {
    font-size: 14px;
  }
}

Removing differing styles in the appropriate media queries
.text {
  color: #222;
}

@media (max-width: 767px) {
  .text {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .text {
    font-size: 14px;
  }
}

Thanks in advance for your reply!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey B., 2018-07-13
@andykov

Mobile First

H
hellcaster, 2018-07-13
@web_Developer_Victor

The bottom line is that mobile devices are weaker than computers, and when you do media queries, the phone needs to first display the desktop version, and then also media queries. And when you do it on the principle of mobile first, then the phone needs to display only one page, without media queries, and computers cope with this anyway

A
Alexander Sevirinov, 2018-07-13
@sevirinov

Mobile-first Style
mobile first as usual without media queries
. And for higher resolutions, edit styles in media queries.

A
Alexander Taratin, 2018-07-13
@Taraflex

You can use https://gist.github.com/indrekpaas/7f22e44ace49b5124eec for font-size and
many other
properties mixins)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question