豆知识扩展:HTML<meta> tag

豆知识:

HTML<meta> tag

Metadata 是关于数据的信息。

The <meta> tag provides metadata关于网页。Metadat不会显示在webpage上,他只用于机器解析。

Meta元素用于指定网页描述,关键字,作者信息等。

metadata能够被用于浏览器(如何显示内容或加载网页),搜索引擎(keywords),或者其他网页服务。

web designers take control over the viewport (the user's visible area of a web page), through the <meta> tag 

 

Tips and Notes

meta标签在head标签内部。

Metadata 是键/值 对儿的表现形式。

如果name被定义了,content必须被定义。

Setting The Viewport

HTML5 introduced a method to let web designers take control over the viewport, through the <meta> tag.

viewport是一个网页上,用户可见的区别。 它根据设备不同而改变大小(phone, ipad)。

在你的网页中,你应该包含以下元素。 

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

A <meta> viewport element gives the browser instructions on how to control the page's dimensions and scaling.

The width=device-width  根据设备屏幕宽度设置网页的宽度。

The initial-scale=1.0 设置当在网页被加载的开始的zoom level


具体w3c: https://www.w3schools.com/Tags/tag_meta.asp

还可以设置author, description, generator , keywords。

在Ruby on rails 这是自动产生的。 

原文地址:https://www.cnblogs.com/chentianwei/p/9183799.html