天天看點

HTML 語言基礎

學習HTML語言,我主要參考了《HTML與CSS網站設計實踐之旅》(Build Your Own Web Site the Right Way Using HTML&CSS)。

最近學習了HTML語言,現在來總結一下。其實,感覺HTML還是比較簡單的,文法很容易懂,就是符号多一些。

最新版本的HTML,即XHTML。

下面是一個簡單的HTML的網頁:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head> 
    <title>The Most Basic Web Page in the World</title> 
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> 
 
  </head> 
  <body> 
    <h1>The Most Basic Web Page in the World</h1> 
    <p>This is a very simple web page to get you started. Hopefully
        you will get to see how the markup that drives the page
        relates to the end result that you can see on screen.</p> 
    <p>This is another paragraph, by the way. Just to show how it
        works.</p> 
  </body> 
</html>
           

以下是HTML的一個基本架構:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head>
    <title></title> 
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  </head> 
  <body> 
    <h1></h1> 
    <p></p> 
    <p></p> 
  </body> 
</html>
           

<title></title>中的内容表示頁面标題,也就是打開網頁,最上面顯示的内容(預設值是Untitled Document),下圖所示樣例中的Google即為頁面标題。

HTML 語言基礎

<body> </body>中的内容是網頁中顯示的内容。

繼續閱讀