A
A
Alexander Vladimirovich2015-09-23 09:06:41
css
Alexander Vladimirovich, 2015-09-23 09:06:41

How to zoom in on a fixed width website?

Hello!
There is a fixed width page, 940px. The font size is 14px.
How to make it so that on any device this page automatically scales to 100% of the device screen width when the screen is opened or rotated, and at the same time, if the screen width is 640px or less, then the font size becomes 16px?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Fedorov, 2015-09-23
@aliencash

These are media queries.
htmlbook.ru/css/value/media
A simple example:

body {
  width: 940px;
}
@media all and (max-width:940px) {
body {
  width: 100%;
}
}

In this case, if the screen width is more than 940px, the width of the body is 940px, otherwise it is 100%.

S
Sarkis Arutiunian, 2015-09-23
@sarkis-tlt

through CSS, to stretch to full width:
for a font with a size less than the specified one, you can use a media query, also in CSS:

@media only all and (max-width: 640px) {
 (селектор) {
  font-size: 16px;
 }

T
TheBububo, 2015-09-23
@TheBububo

0) see how people do
https://vimeo.com/33180097
habrahabr.ru/post/119127
1) add the viewport meta tag so that the browser knows that the page is responsive
2) write media in css

@media  (max-width: 1000px) {
  .wrap { 
    width:100%;
  }
}
@media  (max-width: 640px) {
  body { 
    font-size:16px;
  }
}
и т.п.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question