Javascript幻灯片中心?

时间:2014-02-17 19:32:31

标签: javascript html css

如何在我的代码中将幻灯片放在中心?

JSfiddle:http://jsfiddle.net/H8KkR/

是否有可能与此有关:

   #slideshow {
       height:330px;
       width:400px;
       float:left;
   }
   #slides {
       height:300px;
       position:relative;
   }
   .slide {
       height:300px;
       width:400px;
       overflow:hidden;
       position:absolute;
       background:#000;
       color:#fff
   }
   #slides-controls {
       width:60px;
       background-color:#fff;
       height:20px;
       margin-left:auto;
       margin-right:auto;
       padding:5px;
   }
   #slides-controls a {
       margin:5px;
       width:8px;
       height:8px;
       border-radius:4px;
       -moz-border-radius:4px;
       -webkit-border-radius:4px;
       -o-border-radius:4px;
       background:#F60;
       border:1px solid #fff;
       text-indent:-9000px;
       display:block;
       overflow:hidden;
       float:left;
   }
   #slides-controls a:hover {
       background:#F30;
   }
   #slides-controls a.highlight {
       background:#fff;
       border:1px solid #F30;
   }

1 个答案:

答案 0 :(得分:1)

在第130行,将float: left;替换为margin: 0 auto;(在#slideshow选择器下)