Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use viewport of html5

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of how to use html5's viewport, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this article on how to use html5's viewport. Let's take a look at it.

The code is as follows:

Parameter explanation:

Width

-- controls the size of the viewport. You can specify a value or a special value, such as device-width is the width of the device (in pixels of CSS when scaled to 100%).

Height

-- specify the height corresponding to width.

Target-densitydpi

The pixel density of a screen is determined by the screen resolution and is usually defined as the number of dots per inch (dpi). Android supports three types of screen pixel density: low pixel density, medium pixel density, and high pixel density. A low pixel density screen has fewer pixels per inch, while a high pixel density screen has more pixels per inch. The default screen for Android Browser and WebView is medium pixel density.

The following is the range of values for the target-densitydpi property

Device-dpi: use the original dpi of the device as the target dp. Default scaling does not occur.

High-dpi: use hdpi as the target dpi. The devices with medium pixel density and low pixel density are reduced accordingly.

Medium-dpi: use mdpi as the target dpi. The high pixel density device is enlarged accordingly, and the pixel density device is reduced accordingly. This is the default target density.

Low-dpi: use mdpi as the target dpi. The devices with medium pixel density and high pixel density are enlarged accordingly.

Specify a specific dpi value as target dpi. The range of this value must be between 70ml 400.

Copy the code

The code is as follows:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report