标题干扰Navbars

时间:2016-02-28 14:49:36

标签: html css

我目前正在网站上工作,我也是网站编程的新手,所以如果我有些不对劲,我会道歉。

h1出现在我的Navbar之前,导航栏位于标题下方。有什么建议?谢谢!

HTML:

<!DOCTYPE html>
<html lang="en">

  <head>

    <title>CSGOCarry | Contact</title>
    <link rel="stylesheet" type="text/css" href="contact.css">

  </head>

  <body>

    <div class="container">
      <div class="center">
        <h1>How To Contact Us</h1>
      </div>
    </div>
    <div class="navbar">
      <ul>
        <li><a href="default.asp">Home</a></li>
        <li><a href="Jackpot.asp">Jackpot</a></li>
        <li><a href="Coinflip.asp">Coinflip</a></li>
        <li><a href="Roulette.asp">Roulette</a></li>
        <ul style="float:right;list-style-type:none;">
          <li><a href="Contact.asp">Contact</a></li>
          <li><a href="About.asp">About</a></li>
          <li><a href="https://store.steampowered.com/login/">Sign In</a>
       </li>             
      </ul>
      </ul>
    </div>

  </body>

</html>

JSFiddle w / HTML&amp; CSS: https://jsfiddle.net/fo0u1tcp/

1 个答案:

答案 0 :(得分:0)

您需要更改文档中navcontainer出现的顺序:

<div class="navbar">
  <ul>
    <li><a href="default.asp">Home</a></li>
    <li><a href="Jackpot.asp">Jackpot</a></li>
    <li><a href="Coinflip.asp">Coinflip</a></li>
    <li><a href="Roulette.asp">Roulette</a></li>
    <ul style="float:right;list-style-type:none;">
      <li><a href="Contact.asp">Contact</a></li>
      <li><a href="About.asp">About</a></li>
      <li><a href="https://store.steampowered.com/login/">Sign In</a></li>
    </ul>
  </ul>
</div>
<div class="container">
  <div class="center">
    <h1>How To Contact Us</h1>
  </div>
</div>