2017-08-05 61 views
1

我涉足html,想制作我自己的网站。我试图让链接到页面左侧我最常用的网站,因为我相信这是导航所做的。另外,我似乎无法将我的文本正文放在页面的中心,也不会看到标题。这是我的代码;HTML导航标签无法按预期工作

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    <title>My first webpage</title> 
    </head> 
    <header>Ian Witkowski</header> 
    <nav> 
    <h1>My Favorite Websites</h1> 
    <ul> 
     <li><a href=http://www.youtube.com/>YouTube</a> 
     <li><a href=http://www.google.com/>Google</a> 
     <li><a href=http://www.reddit.com/>Reddit</a> 
    </ul> 
    </nav> 
    <body> 
    <article> 
    <h1>The Penultimate Website</h1> 
    <h2>The Official Homepage of Ian Witkowski</h2> 
    <p>Thank you for visiting my webpage!</p> 
    <dl> 
     <dt><h3>Ian Witkowski</h3></dt> 
     <dd>A cool dude</dd> 
    </dl> 
    <p> 

    Reasons Ian is cool;</p> 
    <ul> 
     <li>He is nice</li> 
     <li>He rides bikes</li> 
     <li>He likes computers</li> 
     <li>He can code his own website</li> 
    </ul> 
    <p>Here is a link for my arbitrary code test page;</p> 
    <ul> 
     <li><a href="secondpage.htm" target="_blank">Ian2</a></li> 
    </ul> 
    </article>  
    </body> 
</html> 

回答

0

nav什么都不做。这只是一个标签,如div。但是HTML5规范的一部分,他们添加了section, nav, footer, header标签来简化页面的描述。

没有CSS,它只是没有关于设计

第二件事的任何特殊行为标签,你有你的HTML错误。除头部之外的所有东西都应该在体内(包括导航)

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    <title>My first webpage</title> 
    </head> 
    <body> 
    <header>Ian Witkowski</header> 
    <nav> 
    <h1>My Favorite Websites</h1> 
    <ul> 
     <li><a href=http://www.youtube.com/>YouTube</a> 
     <li><a href=http://www.google.com/>Google</a> 
     <li><a href=http://www.reddit.com/>Reddit</a> 
    </ul> 
    </nav> 
    <article> 
    <h1>The Penultimate Website</h1> 
    <h2>The Official Homepage of Ian Witkowski</h2> 
    <p>Thank you for visiting my webpage!</p> 
    <dl> 
     <dt><h3>Ian Witkowski</h3></dt> 
     <dd>A cool dude</dd> 
    </dl> 
    <p> 

    Reasons Ian is cool;</p> 
    <ul> 
     <li>He is nice</li> 
     <li>He rides bikes</li> 
     <li>He likes computers</li> 
     <li>He can code his own website</li> 
    </ul> 
    <p>Here is a link for my arbitrary code test page;</p> 
    <ul> 
     <li><a href="secondpage.htm" target="_blank">Ian2</a></li> 
    </ul> 
    </article>  
    </body> 
</html>