Use the `viewport` meta tag to control mobile layout

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.

That's me!

I’m Ajay Karwal. I write about my experiences as a front-end developer. If you enjoy my content, please consider supporting what I do.

Become a PatronBuy me a coffee