<meta>标签用于定义HTML文档中的元数据,例如信息,关键字,作者等。使用HTML5,您可以使用<meta>标签设置视口。
以下是添加元信息和使用<meta>标记的不同方法-
作者
使用以下内容添加网页的作者。
<meta name="author" content="Amit">
说明
使用以下内容定义网页的说明。
<meta name="description" content="Learn from Text and Video Tutorials">
关键字
使用以下将关键字添加到网页。
<meta name="keyword" content="Java, WordPress, Drupal, Android, iOS">
设置视
口视口用于控制移动浏览器上的布局。它用于<meta>标记内,以向浏览器提供有关如何控制网页尺寸和缩放比例的说明。
<meta name="viewport" content="width=device-width, initial-scale=1.0">
您可以尝试运行以下代码来了解<meta>标记。
<!DOCTYPE html> <html> <head> <meta name="description" content="Learn from Text and Video Tutorials"> <meta name="keywords" content="Java, WordPress, Drupal, Android, iOS"> <meta name="author" content="Amit"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <p>This is is demo text. The head tag consists of all the meta information.</p> </body> </html>