2013-04-11 24 views
-19

我有以下html文件:HREF變成全行成一個鏈接

<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <title>Test</title> 

</head> 
<body> 
    <div style="background-color:white; width:800px; margin-left:auto; margin-right:auto; font-size:1.5em;"> 
     <div style="width:80px; display: inline-block; background-color:Green; "> 

     <a href="https://stackoverflow.com"> Test</href> 
     </div> 
     <div style="width:260px; display: inline-block; background-color:Purple; margin-left:auto; margin-right:auto;"> 
      <span>hello1</span> 
     </div> 
     <div style="width:260px; display: inline-block; margin-left:auto; margin-right:auto; background-color:Green;"> 
      <span>hello2</span> 
     </div> 
    </div> 
    <div style="background-color:white; width:800px; margin-left:auto; margin-right:auto; font-size:1.5em;"> 
     <div style="width:80px; display: inline-block; background-color:Green; "> 
      <a href="/e/1234">Test</href> 
     </div> 
     <div style="width:260px; display: inline-block; background-color:Purple; margin-left:auto; margin-right:auto;"> 
      <span>bye1</span> 
     </div> 
     <div style="width:260px; display: inline-block; margin-left:auto; margin-right:auto; background-color:Green;"> 
      <span>bye2</span> 
     </div> 
    </div> 
</body> 
</html> 

在href變成全行成一個鏈接,爲什麼會出現這種情況?我怎樣才能防止它?有沒有錯誤?

+5

''仔細檢查....瞭解如何使用此:http://validator.w3.org/ – 2013-04-11 18:45:09

+0

' Test' should be 'Test' – 2013-04-11 18:45:40

+0

@mog的含義是,您的結束標記應該是'',而不是''。 – 2013-04-11 18:46:27

回答

3

更改此:

<a href="/e/1234">Test</href> 

這樣:

<a href="/e/1234">Test</a>