meta常用的属性有哪些?
时间: 2023-05-25 17:05:24 浏览: 70
一些常用的`meta`属性包括:
1. `charset`:指定文档的字符编码,例如 `<meta charset="UTF-8">`。
2. `name`:为其它属性定义一个名称。
3. `content`:属性的具体内容。
4. `http-equiv`:指定文档的实体头信息,例如 `<meta http-equiv="refresh" content="5; url=http://www.example.com/">`。
5. `viewport`:定义移动设备的视口属性 `<meta name="viewport" content="width=device-width, initial-scale=1.0">`。
6. `description`:网站描述,例如 `<meta name="description" content="This is the description of my website.">`。
7. `keywords`:网站关键字,例如 `<meta name="keywords" content="HTML, CSS, JavaScript">`。
8. `author`:网站作者,例如 `<meta name="author" content="John Doe">`。
相关问题
HTML中的<meta>标签有哪些常用属性?
HTML中的<meta>标签有很多常用属性,其中一些常用属性如下:
1. charset:规定HTML文档的字符编码。
```html
<meta charset="UTF-8">
```
2. name:规定元数据的名称。
```html
<meta name="keywords" content="HTML, CSS, JavaScript">
```
3. http-equiv:提供有关网页的编码和刷新的信息。
```html
<meta http-equiv="refresh" content="30">
```
4. content:提供与name或http-equiv属性相关的元数据的值。
```html
<meta name="description" content="这是一个描述网页的内容">
```
5. viewport:规定网页在移动设备上的显示区域。
```html
<meta name="viewport" content="width=device-width, initial-scale=1.0">
```
常⽤的meta标签有哪些
常用的 meta 标签有以下几种:
1. `<meta charset>` 标签:设置页面的字符集编码,常用的有 UTF-8 和 GB2312 等。
2. `<meta name="viewport">` 标签:设置浏览器视口的大小和缩放比例,用于适配不同设备的屏幕。
3. `<meta name="keywords">` 标签:设置网页的关键词,有助于搜索引擎优化(SEO)。
4. `<meta name="description">` 标签:设置网页的描述信息,也有助于 SEO。
5. `<meta name="author">` 标签:设置网页的作者信息。
6. `<meta http-equiv="refresh">` 标签:设置网页的自动刷新时间,可用于实现页面跳转或定时刷新。
7. `<meta name="robots">` 标签:告诉搜索引擎如何抓取网页内容,常用的属性值有 index(允许搜索引擎抓取并索引该页面)、noindex(不允许搜索引擎索引该页面)等。
8. `<meta name="format-detection">` 标签:设置是否自动识别和格式化电话号码、邮箱地址等信息。
9. `<meta name="apple-mobile-web-app-capable">` 标签:设置是否启用 WebApp 模式,使网页在 iOS 设备上以类似原生应用的形式展现。
10. `<meta name="apple-touch-icon">` 标签:设置 WebApp 在 iOS 设备主屏幕上的图标。