Z
Z
znokia2020-05-24 17:23:38
Adaptive design
znokia, 2020-05-24 17:23:38

Why do desktop CSS rules apply to mobile site?

This rule works for the desktop version of the site. How can I make the mobile version of the site ignore it?

#___gcse_0 input[type="text"] {
    padding: 7px !important;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Nikitin, 2020-05-24
@znokia

1. Check that there is a viewport meta tag in the head.

<meta name="viewport" content="width=device-width, initial-scale=1">

2. Add media to the CSS (decide on your own minimum screen width value in pixels).
@media only screen and (min-width: 480px) {
  #___gcse_0 input[type="text"] {
      padding: 7px !important;
  }
 }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question