天天看点

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>中的内容是网页中显示的内容。

继续阅读