我网站右侧的空白区域,我无法摆脱

时间:2017-12-22 21:19:09

标签: html css

我查看了其他用户遇到的类似问题,但没有一个修复程序对我有用。我大约一年前在网站上开始,从那时起就没有触及它。正如标题所暗示的那样,网站右侧有一些白色空间,我似乎无法摆脱它。



html * {
  font-family: 'Open Sans', sans-serif;
  margin: 0;
}
body{

}
.header1 {
  background: #000;
  filter: alpha(opacity=80);
  -moz-opacity: 0.8;
  -khtml-opacity: 0.8;
  opacity: 0.8;
  background-size: cover;
  height: 100px;
  width: 100%;
  padding: 0;
  position: fixed;
  z-index: 1000;
  margin-right: -12px;
   margin-left: -12px;
   margin-top: -6px;
}

.header1 img {
  float: left;
  width: 258px;
  height: 56px;
  margin-left: 30px;
  margin-top: 44px;
  padding: 0;
}

ul#nav {
  list-style-type: none;
  height: 20px;
  margin-top: 73px;
  -webkit-padding-start: 40px;
  display: block;
}

a:link,
a:visited {
  text-decoration: none;
  color: #FFFFFF !important;
}

ul#nav li.contact a {
  float: right;
  width: 100px;
}

ul#nav li.about a {
  float: right;
  width: 75px;
}

ul#nav li.search a {
  float: right;
  width: 100px;
}

.header2 {
  background: url(rockhdr.png) no-repeat top center fixed;
  background-size: cover;
  height: 600px;
  width: 100%;
  margin-right: -18px;
  margin-left: -8px;
  margin-top: -12px;
  padding: 0;
}

.box {
  background: no-repeat top center fixed;
  margin: auto;
  padding-left: -15px;
  padding-top: 275px;
  width: 400px;
  height: 100px;
  white-space: nowrap;
  position: relative;
}

.container-1 {
  width: 600px;
  height: 200px;
  vertical-align: middle;
  white-space: nowrap;
  position: relative;
  background: #000;
  margin-left: -85px;
  border-radius: 5px;
}

.container-1 input#search {
  width: 300px;
  height: 50px;
  background: #2b303b;
  border: none;
  font-size: 10pt;
  float: left;
  color: #FFFFFF;
  margin-left: 150px;
  margin-top: 60px;
  padding-left: 20px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
}

.container-1 .icon {
  position: absolute;
  top: 50%;
  margin-left: 17px;
  margin-top: 17px;
  z-index: 1;
  color: #FFFFFF;
}

.button {
  position: absolute;
  font-size: 12px;
  left: 150px;
  top: 60%;
  width: 148px;
  height: 20px;
  background: #ffff;
  border: none;
  border-radius: 5px;
}

.advbutton {
  position: absolute;
  font-size: 12px;
  left: 302px;
  top: 60%;
  width: 148px;
  height: 20px;
  background: #ffff;
  border: none;
  border-radius: 5px;
}

.container-1 input#search::-webkit-input-placeholder {
  color: #65737e;
}

.container-1 input#search:-moz-placeholder {
  /* Firefox 18- */
  color: #65737e;
}

.container-1 input#search::-moz-placeholder {
  /* Firefox 19+ */
  color: #65737e;
}

.container-1 input#search:-ms-input-placeholder {
  color: #65737e;
}

h1 {
  text-align: center;
  font-size: 50px;
}

#bottom-wrap {
  background: #000;
}

#bottom {
  width: 100%;
  height: 0;
  padding: 0 0 20%;
  background-size: 100%;
  background-repeat: no-repeat;
  background-size: cover;
  margin-left: auto;
  margin-right: auto;
}

.contact {
  color: #FFFFFF;
  text-align: center;
}

<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="fossils.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="fossils.js"></script>

<div class='header_top'>
  <div class='header1'>
    <img src="GFS/images/eslogo.png" alt="logo" />
    <ul id="nav">
      <li class="contact"><a name="contact" href="#bottom" title="Contact">Contact</a></li>
      <li class="about"><a href="http:///" title="About">About</a></li>
      <li class="search"><a href="/" title="Search">Search</a></li>


  </div>
</div>

<div class='header_box'>
  <div class='header2'>
    <div class="box">
      <div class="container-1">
        <span class="icon"><i class="fa fa-search"></i></span>
        <input type="search" id="search" placeholder="Search..." />
        <form action="advancedsearch.html">
          <input type="submit" class="advbutton" type="button" value="Advanced Search">
        </form>
        <input class="button" type="button" value="Search">
      </div>
    </div>
  </div>
</div>


<iframe src="https://truview.ortery.com/HTMLJavaScript/MotorBike/HTML5Viewer.html"></iframe>

<h1>Catalogued Rocks</h1>



<div id="bottom-wrap">
  <div id="bottom">
    <br>
    <br>
    <br>
  </div>
</div>
&#13;
&#13;
&#13;

非常感谢帮助!

1 个答案:

答案 0 :(得分:0)

只需从header1中删除它:

  margin-right: -12px;
   margin-left: -12px;
   margin-top: -6px;

您所指的白色边距仅在您的标题容器上,而在其他地方,并且上面的负边距是其原因。

&#13;
&#13;
html * {
  font-family: 'Open Sans', sans-serif;
  margin: 0;
}
body{

}
.header1 {
  background: #000;
  filter: alpha(opacity=80);
  -moz-opacity: 0.8;
  -khtml-opacity: 0.8;
  opacity: 0.8;
  background-size: cover;
  height: 100px;
  width: 100%;
  padding: 0;
  position: fixed;
  z-index: 1000;
}

.header1 img {
  float: left;
  width: 258px;
  height: 56px;
  margin-left: 30px;
  margin-top: 44px;
  padding: 0;
}

ul#nav {
  list-style-type: none;
  height: 20px;
  margin-top: 73px;
  -webkit-padding-start: 40px;
  display: block;
}

a:link,
a:visited {
  text-decoration: none;
  color: #FFFFFF !important;
}

ul#nav li.contact a {
  float: right;
  width: 100px;
}

ul#nav li.about a {
  float: right;
  width: 75px;
}

ul#nav li.search a {
  float: right;
  width: 100px;
}

.header2 {
  background: url(rockhdr.png) no-repeat top center fixed;
  background-size: cover;
  height: 600px;
  width: 100%;
  margin-right: -18px;
  margin-left: -8px;
  margin-top: -12px;
  padding: 0;
}

.box {
  background: no-repeat top center fixed;
  margin: auto;
  padding-left: -15px;
  padding-top: 275px;
  width: 400px;
  height: 100px;
  white-space: nowrap;
  position: relative;
}

.container-1 {
  width: 600px;
  height: 200px;
  vertical-align: middle;
  white-space: nowrap;
  position: relative;
  background: #000;
  margin-left: -85px;
  border-radius: 5px;
}

.container-1 input#search {
  width: 300px;
  height: 50px;
  background: #2b303b;
  border: none;
  font-size: 10pt;
  float: left;
  color: #FFFFFF;
  margin-left: 150px;
  margin-top: 60px;
  padding-left: 20px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
}

.container-1 .icon {
  position: absolute;
  top: 50%;
  margin-left: 17px;
  margin-top: 17px;
  z-index: 1;
  color: #FFFFFF;
}

.button {
  position: absolute;
  font-size: 12px;
  left: 150px;
  top: 60%;
  width: 148px;
  height: 20px;
  background: #ffff;
  border: none;
  border-radius: 5px;
}

.advbutton {
  position: absolute;
  font-size: 12px;
  left: 302px;
  top: 60%;
  width: 148px;
  height: 20px;
  background: #ffff;
  border: none;
  border-radius: 5px;
}

.container-1 input#search::-webkit-input-placeholder {
  color: #65737e;
}

.container-1 input#search:-moz-placeholder {
  /* Firefox 18- */
  color: #65737e;
}

.container-1 input#search::-moz-placeholder {
  /* Firefox 19+ */
  color: #65737e;
}

.container-1 input#search:-ms-input-placeholder {
  color: #65737e;
}

h1 {
  text-align: center;
  font-size: 50px;
}

#bottom-wrap {
  background: #000;
}

#bottom {
  width: 100%;
  height: 0;
  padding: 0 0 20%;
  background-size: 100%;
  background-repeat: no-repeat;
  background-size: cover;
  margin-left: auto;
  margin-right: auto;
}

.contact {
  color: #FFFFFF;
  text-align: center;
}
&#13;
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="fossils.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="fossils.js"></script>

<div class='header_top'>
  <div class='header1'>
    <img src="GFS/images/eslogo.png" alt="logo" />
    <ul id="nav">
      <li class="contact"><a name="contact" href="#bottom" title="Contact">Contact</a></li>
      <li class="about"><a href="http:///" title="About">About</a></li>
      <li class="search"><a href="/" title="Search">Search</a></li>


  </div>
</div>

<div class='header_box'>
  <div class='header2'>
    <div class="box">
      <div class="container-1">
        <span class="icon"><i class="fa fa-search"></i></span>
        <input type="search" id="search" placeholder="Search..." />
        <form action="advancedsearch.html">
          <input type="submit" class="advbutton" type="button" value="Advanced Search">
        </form>
        <input class="button" type="button" value="Search">
      </div>
    </div>
  </div>
</div>


<iframe src="https://truview.ortery.com/HTMLJavaScript/MotorBike/HTML5Viewer.html"></iframe>

<h1>Catalogued Rocks</h1>



<div id="bottom-wrap">
  <div id="bottom">
    <br>
    <br>
    <br>
  </div>
</div>
&#13;
&#13;
&#13;