导航菜单滑块图像在html中向左移动

时间:2015-04-06 08:05:53

标签: html css

嗨,在下面的代码中,我正在显示滑块图像和菜单。现在,在页面中添加的菜单意味着当我删除导航菜单时,所有滑块图像都会向左移动,它使滑块图像完全正确。

但是我想要显示导航菜单,应该以相同的宽度和高度显示左侧和滑块图像。

任何人都可以帮助我

HTML

<div id="main">

<ul id="navigationMenu">
   <li>
        <a class="home" href="index.html">
            <span>Home</span>
        </a>
    </li>

    <li>
        <a class="about" href="About.html">
            <span>About Us</span>
        </a>
    </li>

    <li>
         <a class="services" href="Specialties.html">
            <span>Specialties</span>
         </a>
    </li>

    <li>
        <a class="portfolio" href="facilities.html">
            <span>Facilities</span>
        </a>
    </li>

    <li>
        <a class="contact" href="Contact.html">
            <span>Contact us</span>
        </a>
    </li>
</ul>

</div> 
<div id="sliders1">
      <div id="slider">
      <div class="gallery">
        <ul class="images">
          <li class="show"><img width="950" height="300" src="img/1.jpg" alt="photo_one" /></li>
          <li><img width="950" height="300" src="img/2.jpg" alt="seascape" /></li>
          <li><img width="950" height="300" src="img/3.jpg" alt="seascape" /></li>
          <li><img width="950" height="300" src="img/4.jpg" alt="seascape" /></li>
          <li><img width="950" height="300" src="img/5.jpg" alt="seascape" /></li>
          <li><img width="950" height="300" src="img/6.jpg" alt="seascape" /></li>
        </ul>
      </div>
     </div>
     </div>

CSS

#slider {   
  width: 1050px;
  overflow: hidden;
  margin:0px auto;
  height:300px;
} 
.gallery{
  width:100%;
  height:100%;
}

ul.images {
  width:1050px;
  height:100%;

  overflow:hidden;
  position:relative;
  margin:0px auto;
  padding:0;

} 

ul.images li {
  position:absolute;
  margin:0;
  padding:0;
  left:0;
  right:0;
  list-style:none;
}

ul.images li.show {
  z-index:500; 
  width:1050px;
  height:300px;
 overflow:hidden;
  background-size:100% 100%;
}

ul.images  li img {
  border-style: none;
   width:1050px;
  height:100%; 
   outline:none;
}
#navigationMenu li{
    list-style:none;
    height:55px;
    padding:2px;
    width:50px;

     }

#navigationMenu span{
    /* Container properties */
    width:0;
    left:38px;
    padding:0;
    position:absolute;
    overflow:hidden;

    /* Text properties */
    font-family:'Myriad Pro',Arial, Helvetica, sans-serif;
    font-size:18px;
    font-weight:bold;
    letter-spacing:0.6px;
    white-space:nowrap;
    line-height:39px;

    /* CSS3 Transition: */
    -webkit-transition: 0.25s;

    /* Future proofing (these do not work yet): */
    -moz-transition: 0.25s;
    transition: 0.25s;
}

#navigationMenu a{
    background:url('img/n1.png') no-repeat;

    height:39px;
    width:38px;
    display:block;
    position:relative;
}



#navigationMenu a:hover span{ width:auto; padding:0 20px;overflow:visible;}
#navigationMenu a:hover{
    text-decoration:none;

    /* CSS outer glow with the box-shadow property */
    -moz-box-shadow:0 0 5px #9ddff5;
    -webkit-box-shadow:0 0 5px #9ddff5;
    box-shadow:0 0 5px #9ddff5;
}

/* Green Button */

#navigationMenu .home { background-position:0 0;}
#navigationMenu .home:hover {   background-position:0 -39px;}
#navigationMenu .home span{
    background-color:#7da315;
    color:#3d4f0c;
    text-shadow:1px 1px 0 #99bf31;
}

/* Blue Button */

#navigationMenu .about { background-position:-38px 0;}
#navigationMenu .about:hover { background-position:-38px -39px;}
#navigationMenu .about span{
    background-color:#1e8bb4;
    color:#223a44;
    text-shadow:1px 1px 0 #44a8d0;
}

/* Orange Button */

#navigationMenu .services { background-position:-76px 0;}
#navigationMenu .services:hover { background-position:-76px -39px;}
#navigationMenu .services span{
    background-color:#c86c1f;
    color:#5a3517;
    text-shadow:1px 1px 0 #d28344;
}

/* Yellow Button */

#navigationMenu .portfolio { background-position:-114px 0;}
#navigationMenu .portfolio:hover{ background-position:-114px -39px;}
#navigationMenu .portfolio span{
    background-color:#d0a525;
    color:#604e18;
    text-shadow:1px 1px 0 #d8b54b;
}

/* Purple Button */

#navigationMenu .contact { background-position:-152px 0;}
#navigationMenu .contact:hover { background-position:-152px -39px;}
#navigationMenu .contact span{
    background-color:#af1e83;
    color:#460f35;
    text-shadow:1px 1px 0 #d244a6;
}
 #main {
        margin:0px auto;
       position: relative;
       width: 40px;
       float: left;

    }

0 个答案:

没有答案