Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
453 views
in Technique[技术] by (71.8m points)

html - How is the meta viewport tag used, and what does it do?

  1. What browsers support this meta tag?
  2. How do i use it?
  3. Does this mean it will solve all my mobile resizing problems?

If anyone could answer this it would be a great help to newbies learning

<meta="viewport">
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. The viewport browser support is a little bit across the board. I'll point you to the Quirksmode page for viewport browser support for the full details.
  2. You use the viewport meta tag like any other meta tag. Put the code block straight up in the <head>.
  3. Pretty much, but again, a little bit of a mouthful to say here. I'd advise reading some articles, reading the W3 mobile best practices for web design, or the current W3 draft specifications on the viewport attribute for the <meta> tag.

In short, adding this line to a website that should implement viewport scaling should fix most problems. (copied from WebDesignTuts+'s "Quick Tip: Don't Forget the Viewport Meta Tag" article)

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

P.S. Quirksmode also has a rather wonderful article describing the issue that's worth reading to understand why this might be helpful.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...