html5 javascript webpage responsive design scheme, webpage adaptation scheme

The style of the design of the web page is controlled by css. Our css size unit is generally px, or rem, or vw, vh.

The size controlled by px is fixed, not loudness.

Responsive design is generally implemented in two ways.

One.rem program.

Implementation:

1. Add in the head

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2. Introduce flexible.js
The content is as follows
 (function flexible(window, document) {   function resetFontSize() {     const size = (document.documentElement.clientWidth / 1920) * 37.5;//1920 is the width of the design draft document.documentElement.style.fontSize = size + 'px';   }    // reset root

The post html5 javascript Web Responsive Design, Web Adaptation first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/9507
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment