Viewport is a necessary tag to display the HTML page correctly

Viewport meta tag

2023-10-21 13:45:04

Viewport – this is the screen that the user actually sees. A simple description of this parameter is measured by the size of the diagonal. In practice, the description of the visible area of the monitor page is a set of parameters, including diagonal, aspect ratio, and the number of pixels per unit area.

Viewport HTML – how a new task for the adaptive screen appeared

Obviously, small smartphones have the smallest diagonal, and large monitors have the largest. However, the current era was preceded by a time of less developed technology, so the variety of gadgets was less. The screen parameters did not differ significantly and there was no need to enter a new parameter in the page header. The state of the art allowed the use of both flexible and fixed markings. In fact, what difference does it make if the sites are still viewed under approximately the same conditions?

But the creation of a mobile device brought novelty to this issue. The gadget already has a wide range of parameters, including pixel resolution. Thus, the screen visibility area has become more variable, which posed a challenge for developers to adapt the site page to the device. Viewport HTML was created later. Initially, the issue was resolved by making changes to the site design file.

CSS3 – Today almost all devices support this specification. But it also has drawbacks. Due to the variety of screen resolutions, responsiveness has to be created for each parameter separately. Two smartphones may have an identical diagonal, but the number of dots per unit area may differ by a factor of two. This is exactly the difference that can be observed between Apple products.

iPhone 3 ________ 320 - 480

iPhone 4 ________640 - 960

Smartphone models from the same manufacturer differ in the number of dots on the screen by a factor of two. Inaccurate determination of font sizes and block outlines resulted in inconvenient horizontal scrolling. This caused great discomfort for Internet users.

Meta Viewport is a tool that takes into account the shortcomings of the CSS3 design file. Vertical scrolling is considered natural for any page. It is horizontal scrolling that causes inconvenience. The text is difficult to read if you have to constantly move it to the sides. This defect occurs precisely because of the inaccuracy in determining the width of the page. And the user can set the screen horizontally.

meta name=”viewport” content=”width=680”

The parameter is added in the header of the HTML page. The example specifies two parameters: tag name and width. Viewport Meta Tag - this line allows you to set the exact width of the screen. Thanks to this, the text block completely covers the width of the screen.

Viewport device-width How to adapt a website to a smartphone screen, taking into account the font

Below is a simple example of a line that will save the situation. Tag options have many more options, but this is what the simple spelling looks like.

Option 1

meta name=”viewport” content=”width=device-width, initial-scale=1.0

Option 2

meta name=”viewport” content=”width=device-width, initial-scale=1” /

Viewport width The parameter tells the browser exactly how to process the page. In the above examples, we could notice a difference in defining the screen width.

width=680

width=device-width, initial-scale=1.0

The first example sets a fixed monitor screen width. This can be a positive integer between 200 and 1000 points. The second example adapts the page content to different screens.

height= 680

height= device-height, initial-scale=1.0

Viewport height The first line specifies the screen height, an integer from 233 to 1000 pixels.

Page zoom options

The list of parameters indicates the main scaling methods. Important note - in practice, it is recommended to use only the first parameter, since the rest will make it difficult for the user to view the page and reduce the accessibility of the content.

Where should the Viewport tag be located on an HTML page?

Head – This is the section of every HTML page that should contain the Viewport parameter. Please note that some browsers do not honor the page adaptation tag.

For such cases, old tags are used. Popular website builders such as WordPress do not automatically assign customization options. To resolve the issue, you need to use a special plugin. But this does not mean that the Viewport meta tag can not be written in the code. In this case, the search engine will take this into account as an error. Therefore, an indication of the scale must be written on the HTML page.

The absence of a Viewport tag is considered an error by search engines. Although website builders do not automatically write this line, and some browsers do not yet take it into account, care must be taken to ensure that the page displays this line. Also, you should not treat the issue formally. A lack of width and scaling parameters, or incorrectly written code will also lead to an error and poor website ranking in search results.

URL special characters 6URL parameters when creating the site page address___ HTML code 5What is the code tag used for?___ HTML pre 4PRE-HTML tags for displaying code on the page___ Work and ChatGPT 3Will the new chatbot take the job? Who is at risk?___ ChatGPT account 2What you need to register in ChatGPT___ ChatGPT logo 1ChatGPT - a new question-solving tool___
Indexing images for search engines Ukraine is losing 1 thousand IT specialists per month Freelancer's first order Indexing images on a website can be used for promotion-4 _ URL special characters Freelancing for beginners - what do you need to know to get your first order?+0 _ Viewport meta tag Composer download – what is needed to run the program+1 _ Personnel leak What ports are used? Find out on Windows10 via command line+2 _ Learn about open and closed ports Disable port blocking in the firewall program window
HTML pre Inserting computer code content through HTML tags and special characters___ HTML code Code - tag functions and features___ URL special characters How to use special characters when creating a website page URL___ Simple HTML code for embedding a YouTube video___
Opening ports using a terminal Windous command line will help you open the port___ Find out the port status One line will display the port status in the terminal___ Firewall check disabled How can I check if my firewall is still running after I turn it off?___ Creating a table in a Laravel database How to create or drop a table when working with the Laravel framework?___ Simple PowerShell commands for working with files Basic PowerShell Commands Every PHP Developer Should Know___ How many millionaires in the world in 2023 Growth and decline in the number of millionaires in the world from 2021 to 2023___ The richest people on the planet are billionaires Differences in the thinking of millionaires and billionaires - basic qualities___ Pokemon Go profit Java for the Pokemon Go application and profit from the game___