V
V
Vasya2016-10-29 09:20:24
Mobile development
Vasya, 2016-10-29 09:20:24

How to remove horizontal scroll in mobile phones?

There is a site with a minimum width of 640px, the problem is that when you enter from a device with a resolution of less than 640px, a horizontal scroll appears. Worth The body has a minimum width of 640. How can I get rid of this scroll?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Goryachev, 2016-10-29
@webirus

We work with the line meta name viewport.
Let's add an identifier to simplify the work of m640 .
And connect a simple script somewhere in the head.

<script>
if (screen.width < 640)
{
    var mvp = document.getElementById('m640');
    mvp.setAttribute('content','width=640');
}
</script>

The script replaces the width value for screens less than 640 pixels, so that the site starts to "fit in".
Tested on iPhone 5.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question