skip to main content

Use the `viewport` meta tag to control mobile layout

07 May, 2020

Posted in code
Tagged html

Add this single line of code to your webpage’s <head> section if you’re experiencing layout problems on mobile devices.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

This is the absolute minimum you will need to make your webpage render properly on mobile.

If you require even greater control over your mobile layout check out the full viewport meta tag spec.