JHoffman
JHoffman

Reputation: 11

Where do I need to place these viewport meta tags in my html and css files?

I put these tags at the end of my files but they don't work; where should they be placed in my files? HTML Tag

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

and CSS Tag

@-ms-viewport{ width: device-width; }

Upvotes: 1

Views: 4126

Answers (2)

user3351605
user3351605

Reputation: 1291

Generally, meta elements (including viewport) should be placed in the document's <head>.

CSS rules should either be added to a CSS stylesheet and referenced with a <link> element or, if you're not using stylesheets for some reason, in a <style> element (also in the document's <head>).

Documentation for head, meta, style, and link elements.

Upvotes: 0

DuyguKeskek
DuyguKeskek

Reputation: 343

Put the first code block between your header tags in your HTML :

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

The second one should be placed on the top of your css file so it should be global.

Upvotes: 2

Related Questions