B
B
bloodrazorr2015-10-08 01:27:44
HTML
bloodrazorr, 2015-10-08 01:27:44

How to set the minimum site width on mobile devices?

Good day to all. The question arose when developing a site with an adaptive design. Is there any way to set the minimum site width in pixels in the meta name="viewport". For example, do not reduce it to less than 600px if the screen width is less than the specified size, but apply scaling. If the screen width is more than 600px, then display the site according to the width of the device. Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill, 2015-10-08
@bloodrazorr

Usually use:

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

And if you want the minimum width to be 600px, then
<meta name="viewport" content="width=600, initial-scale=1">

Let's say we have a page in a div with id=page
Then the CSS is already composed of media-queries (media queries)
html, body {
       width: 100%;
}
#page {
       /* максимальная ширина страницы - 600px */
       width: 600px;
}

@media all and (max-width: 600px) {
  #page {
    /* максимальная ширина страницы - 100% - для телефонов */
         width: 100%;
  }
}

And so on by analogy.
The width of the site itself is best described in a div inside the body tag . Also, take a
look here .

T
Tlito, 2015-10-08
@tlito

you need to set min-width for the main block, for example wrapper,
or insert a table of zero height and 600 width as a spacer in the top right after the opening body

<body>
<table height=0 width=600 border=0><tr><td></td></tr></table>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question