HTMLcontent 屬性


<meta> 元素的 content 屬性用於設定 HTML 文件中的元資訊。這可以是 description“或關鍵字的資訊,用於 name 屬性。

以下是語法

<meta content="text">

上面,文字是元資訊。

下面我們來看一個例子來實現 <meta> 元素的 content 屬性

示例

 實際效果演示

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Learn for free">
</head>
<body>
<h2>Tutorials</h2>
<p>Programming tutorials for free:</p>
<ol>
   <li>Java</li>
   <li>C++</li>
   <li>C</li>
   <li>C#</li>
</ol>
</body>
</html>

輸出

在上面的示例中,在 <head> 元素下,我們設定了 <meta> description

<head>
<meta name="description" content="Learn for free">
</head>

description 即元資訊是使用 <meta> 元素的 content 屬性設定的

content="Learn for free"

更新時間:30-07-2019

319 次瀏覽

開啟你的 職業生涯

完成課程獲取認證證書

開始學習
廣告
© . All rights reserved.