S
S
SexyMonkey2016-02-24 17:09:29
css
SexyMonkey, 2016-02-24 17:09:29

Why doesn't overflow-x:hidden work on mobile?

To stretch the background of the block outside the central container, I use this design.

body {
      overflow-x:hidden
}
.test {
      position:relative
}
.test:before {
      content: '';
      width: 1000rem;
      height: 520rem;
      position: absolute;
      top: 0;
      right: -1000rem;
}

This works great on desktop, but on mobile the scrolling doesn't disappear.
What is the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Serj-One, 2016-02-25
@SexyMonkey

Мобильные браузеры игнорируют overflow-x:hidden для html и body при использовании <meta name="viewport">
Проблема решается добавлением этого свойства отдельным секциям.

Станислав Зиненко, 2019-09-11
@djstanislaff

Так же, при установке не срабатывает:

body {
      overflow-x: hidden;
}

Но при установке совместно с html - неожиданно сработало
html, body {
      overflow-x: hidden;
}

Дмитрий Чуприна, 2016-02-24
@mufenman

overflov-x:hidden - синтаксическая ошибка overflow и еще может мобильный браузер не знать overflow-x и еще используй просто

body {
      overflow: hidden
 max-width: 100%
}

или смотря какую ширину нужно

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question