Viewports for Mobile Header Tags Quick Reference

Viewports for Mobile Header tags are something that I think we should be able to just copy and paste. It makes things faster when you are programming.

A Viewport tag will auto enlarge text on smaller screens so they are mobile friendly. You would put this code in your header.php file.

[code]<meta name="viewport" content="width=device-width, initial-scale=1">[/code]

Pixels are not an exact Measurement

When you are using viewport tags it is important to note that pixels are not an exact measurement. See this article about pixels to get a better understanding. It will help you understand there is a difference between device width pixels and CSS pixels.

Using the Viewport Tag For Mobile Widths

This is just a quick article to let you know that when you want a mobile friendly website use the viewport tag so things are scaled to a device.

You can also target widths in the viewport tag for pages that have a maximum scale.

[code]<meta name="viewport" content="width=500, initial-scale=1">[/code]

[code]<meta name="viewport" content="initial-scale=1, maximum-scale=1">[/code]

I created this post for my own quick reference. There is a more in depth article on this located here.

Viewports for Mobile Header Tags Quick Reference was last modified: April 28th, 2022 by Maximus Mccullough

Viewports for Mobile Header Tags Quick Reference

Leave a Reply

Your email address will not be published. Required fields are marked *