0

だから私は HTML と CSS を使って学校用のウェブページを作らなければなりません。コード プレビューで表示するとすべて問題ないように見えますが、サーバーに配置すると、ナビゲーション バーが本体と整列しなくなります

ここに私のCSSがあります

body {
    background-color:#2AA890
}

nav {
    margin: auto;
    width: 1000px;
}

ul {
    padding: 0px;
    margin: 45px;
    list-style: none;
}

li a:link, li a:visited, li.selected {
    float: left;
    width: 110px;
    line-height: 3em;
    background-color: #e9e9e9;
    color: #000000;
    font-size: 16px;
    text-align: center;
    text-transform:capitalize;
    text-decoration: none;
    border-right: 3px #ba0000 solid;
}

li:last-child a {
    width: 110px;
    border-right: 0px #6e2525 solid;
}

.head {
    text-align: left;
    padding: 10px 10px 10px 10px
}

.box {
    margin-left: 185;
    width: 882;
    height: 450;
    background-color: #acacac;
    text-align: left;
    padding: 30px 10px 10px 10px
}

.pic1 {
    width:900px;
}

.pic1 img {
    float:right;
}

.pic1 p {
    text-indent: 40px;
    line-height: 1.5em;
    font-family: sans-serif;
    font-size: 17px; 
    margin-right:400px;
}

.head {
    padding: 25px 0px 0px 45px  
}

.pic1 p {
    padding: 0px 5px 10px 8px
}

.pic1 img{
    padding: 30px 20px 20px 10px;
}

ここに私のHTMLがあります

<! DOCTYPE html>
<html>
<head>
  <title>Home</title>
  <link rel="stylesheet" type="text/css" href="normalize.css">
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <nav>
    <ul>
      <li><a href="index.html">Home</a></li>
      <li><a href="Supplies.html">Supplies</a></li>
      <li><a href="Step_1.html">Step 1</a></li>
      <li><a href="Step_2.html">Step 2</a></li>
      <li><a href="Step_3.html">Step 3</a></li>
      <li><a href="Step_4.html">Step 4</a></li>
      <li><a href="Step_5.html">Step 5</a></li>
      <li><a href="Step_6.html">Step 6</a></li>
    </ul>
  </nav>

  <div class="box">
    <div class="pic1">
      <img src="drew_brophy.jpg" alt="Art" title="Drew Brophy" width="480" height="374">
      <div class="head">
        <h2>How to Paint a Surfboard</h2>
      </div>
      <p>The surfboard, one of the most fun toys around.  There is just one problem with it.  The majority of them are plane white.  There is no color and adding some stickers isn't a true way to express yourself!  With a little time and some common items from your garage or hardware, you can make it so much better.  You don't have to be a great artist or have lots of money to truly make that board your own.  This site is a simple guide with some tips and tricks for painting your surfboard.  When the waves aren't breaking and your looking at that board in the corner of your room, take some time and change it up! </p>
      </div>
    </div>
  </body>
</html>
4

2 に答える 2

0

こんにちは、あなたの ul と .box クラスのマージンを確認して、同じマージン左を設定してください。

ul {
  margin:45px 0px;
}
.box {
  margin-left:0px;
}

ここで確認してくださいhttp://jsfiddle.net/

于 2013-10-17T22:05:53.147 に答える