context标签如何声明
时间: 2023-05-29 10:07:42 浏览: 43
在HTML中,可以使用以下方式声明context标签:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Webpage</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Person",
"name": "John Smith",
"jobTitle": "Software Engineer"
}
</script>
</head>
<body>
<h1>Welcome!</h1>
<p>This is my webpage.</p>
</body>
</html>
```
在上述示例中,我们使用`<script>`标签声明了一个`application/ld+json`类型的脚本,该脚本中包含了一个JSON-LD对象,其中指定了`@context`属性为`https://schema.org/`,表示该对象遵循Schema.org的标准。接下来定义了一个`@type`属性为`Person`,表示该对象类型为人物,然后定义了一些其他属性。