如何在水平线上显示导航栏项目以及网站名称?

How to display items of navigation bar in a horizontal line along with the website's name?

我是 HTML 和 CSS 编码的新手。 我正在尝试创建一个导航栏,其左侧为网站名称,右侧为水平线的所有导航选项。 我已经添加了横幅图片,但是当我 运行 代码时它没有显示。我希望这个横幅图片出现在导航栏的正下方。 我当前的代码在导航栏中垂直显示带有项目符号的选项。 请在这方面帮助我。

 .wrapper{
    width:600px;
    background:#eee;
    margin: 0 auto 0 auto;
}

.heading{
    height:100px;
    background:red;
    padding:20px;
    text-align: center;
}

.navigation{
     height:100px;
     background: lightgreen;
     width: 400%;
     margin-top: 10px;
     margin-bottom: 10px;
     font-size:16pt;
     font-family:impact;
     padding:10px;

}

.navigation ul{
     list-style-type: none;
     display: inline;
     text-align: center;
}

.navigation ul li{
     list-style: none;
     display: inline;
     margin-right:30px;
     padding:6px;
}

.navigation a{
     color:white;
     text-decoration: none;
}

.navigation a:hover{
     color:black;
}

.banner{
background: url(mtp.png);
background-size: cover;
width: 100%;
height:800px;
position: fixed;
top:100px;
}

.content{
    min-height: 100px;
    background:#ddd;
    width: 400px;
    float: left;
    position: relative;
}

.sidebar{
    width: 200px;
    float:right;
    background:lightblue;
    min-height: 400px;
}

.footer{
    clear:both;
    background:red;
    height:40px;
    color:white;
    text-align:center;
    padding:10px;
}

我的 html 代码如下:

<!DOCTYPE html>
<html>
    <head>
       <title>HELLO</title>
       <link rel="stylesheet" href="style.css" type="text/css" />
    </head>
    <body>
       <div class="wrapper">
          <div class="heading">
           <h1>WEBSITE NAME</h1>
       </div>
       <div class="navigation"
          <ul>
              <li><a href="#">HOME</a></li>
              <li><a href="#">LOGIN</a></li>
              <li><a href="#">SIGN UP</a></li>
          </ul>
       </div>
  <div id="container">
   <div id="banner">
     <h1>This is my banner</h1>
   </div>
  </div>
       <div class="content">
        STAY     SHOP  ATTRACTIONS
       </div>
       <div class="sidebar">
        DINE
       </div>
       <div class="footer"
        All copyrights reserved
       </div>
   </div>
    </body>
</html>

添加这个css

.heading {
    float: left;
}

你的 html

<div class="wrapper">
    <div class="heading">
        <h1>WEBSITE NAME</h1>
    </div>
    <div class="navigation">
        <ul>
            <li><a href="#">HOME</a></li>
            <li><a href="#">LOGIN</a></li>
            <li><a href="#">SIGN UP</a></li>
        </ul>
    </div>
    <div id="container">
        <div id="banner">
            <h1>This is my banner</h1>
        </div>
    </div>
    <div class="content">
        STAY     SHOP  ATTRACTIONS
    </div>
    <div class="sidebar">
        DINE
    </div>
    <div class="footer">
        All copyrights reserved
    </div>
</div>

按照以下方式更新您的 css

li{
list-style:none;
float:left;
margin-right:50px;
}

.heading{
    height:100px;
    background:red;
    padding:20px;


}

wrapper {
  width: 600px;
  background: #eee;
  margin: 0 auto 0 auto;
}
li {
  list-style: none;
  float: left;
  margin-right: 50px;
}
.heading {
  height: 100px;
  background: red;
  padding: 20px;
}
.navigation {
  height: 100px;
  background: lightgreen;
  width: 400%;
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 16pt;
  font-family: impact;
  padding: 10px;
}
.navigation ul {
  list-style-type: none;
  display: inline;
  text-align: center;
}
.navigation ul li {
  list-style: none;
  display: inline;
  margin-right: 30px;
  padding: 6px;
}
.navigation a {
  color: white;
  text-decoration: none;
}
.navigation a:hover {
  color: black;
}
.banner {
  background: url(mtp.png);
  background-size: cover;
  width: 100%;
  height: 800px;
  position: fixed;
  top: 100px;
}
.content {
  min-height: 100px;
  background: #ddd;
  width: 400px;
  float: left;
  position: relative;
}
.sidebar {
  width: 200px;
  float: right;
  background: lightblue;
  min-height: 400px;
}
.footer {
  clear: both;
  background: red;
  height: 40px;
  color: white;
  text-align: center;
  padding: 10px;
}
<!DOCTYPE html>
<html>

<head>
  <title>HELLO</title>
  <link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>
  <div class="wrapper">
    <div class="heading">
      <h1>WEBSITE NAME</h1>
    </div>
    <div class="navigation" <ul>
      <li><a href="#">HOME</a>
      </li>
      <li><a href="#">LOGIN</a>
      </li>
      <li><a href="#">SIGN UP</a>
      </li>
      </ul>
    </div>
    <div id="container">
      <div id="banner">
        <h1>This is my banner</h1>
      </div>
    </div>
    <div class="content">
      STAY SHOP ATTRACTIONS
    </div>
    <div class="sidebar">
      DINE
    </div>
    <div class="footer">
      All copyrights reserved
    </div>
  </div>
</body>

</html>