HTML標簽
在HTML結構代碼中可以看到非常多的<>
,這就是html的標簽。整塊html代碼幾乎就是由各種各樣的標簽與標簽內容構成,每一個標簽對應一個網頁上的一個小模塊,如一段文字1,一張圖片。對於一個網頁來說,學習一些常用的標簽,90%的網站都可以慢慢搭建出來。
head標簽的組成
meta
meta標簽共有兩個屬性,它們分別是http-equiv屬性和name屬性,不同的屬性又有不同的參數值,這些不同的參數值就實現了不同的網頁功能。
http-equiv
在html4.01版本中,我們使用下面配置來規定HTML 文檔的字符編碼。
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
但在html5版本中,我們使用更簡化的方式來規定HTML 文檔的字符編碼。
<meta charset="UTF-8">
我們用meta標簽可以聲明當前這個html文檔的字庫,但是一定要和保存的類型一樣,否則亂碼!
name
主要用於頁面的關鍵字和描述,是寫給搜索引擎看的,關鍵字可以有多個用 ‘,’號隔開,與之對應的屬性值為content,content中的內容主要是便於搜索引擎機器人查找信息和分類信息用的。
<meta name="Keywords" content="騰訊,郵箱,游戲,新聞,體育,娛樂,論壇,短信" />
這些關鍵詞,就是告訴搜索引擎,這個網頁是干嘛的,能夠提高搜索命中率。讓別人能夠找到你,搜索到。
<meta name="Description" content="網易是中國領先的互聯網技術公司,為用戶提供免費郵箱、游戲、搜索引擎服務,開設新聞、娛樂、體育等30多個內容頻道,及博客、視頻、論壇等互動交流,網聚人的力量。" />
設置Description頁面描述,那么百度搜索結果,就能夠顯示這些語句,這個技術叫做SEO(search engine optimization,搜索引擎優化)。
title標簽
主要用來告訴用戶和搜索引擎這個網頁的主要內容是什么,搜索引擎可以通過網頁標題,迅速的判斷出當前網頁的主題。title標簽會顯示在瀏覽器的標題欄中。
body
標簽body是一個網頁的身體部分,也就是用於定義網頁的主體內容,也是一個HTML文檔中必須的部分。
<body>
<div id="custom-bg"></div>
<!-- Container for the OneGoogleBar HTML. -->
<div id="one-google" class="hidden"></div>
<div id="ntp-contents">
<div id="logo">
<!-- The logo that is displayed in the absence of a doodle. -->
<div id="logo-default" title="Google"></div>
<!-- Logo displayed when theme prevents doodles. Doesn't fade. -->
<div id="logo-non-white" title="Google"></div>
<!-- A doodle, if any: its link and image. -->
<div id="logo-doodle">
<div id="logo-doodle-container">
<button id="logo-doodle-button">
<img id="logo-doodle-image" tabindex="-1"></img>
</button>
</div>
<iframe id="logo-doodle-iframe" scrolling="no"></iframe>
<!-- A spinner, prompting the doodle. Visible on NTPs with customized
backgrounds. -->
<button id="logo-doodle-notifier">
<div class="outer ball0"><div class="inner"></div></div>
<div class="outer ball1"><div class="inner"></div></div>
<div class="outer ball2"><div class="inner"></div></div>
<div class="outer ball3"><div class="inner"></div></div>
</button>
</div>
</div>
</body>