JQuery Cycle,图像中心

标签 jquery css

我正在尝试构建一个 jQuery Cycle 实现。我有一个 css 问题我不知道为什么照片不在中间,我正在使用网站 http://jquery.malsup.com/cycle/ 的 jQuery Cycle , 预先感谢您的帮助。

enter image description here


CSS

<style type="text/css">

body {
            font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
            background-color: #42413C;
            margin: 0;
            padding: 0;
            color: #000;
}

.container {
            position: relative;
            width: 1100px;
            background-color: #FFF; 
            margin-top: 0;
            margin-right: auto;
            margin-bottom: 0;
            margin-left: auto;
}


.content {          
            padding: 10px 0;
}


.pics {     
            width: auto;
            height: auto;
        } 


.pics img {  
            display: block;
            margin-left: auto;
            margin-right: auto;
            padding: 15px;  
            border:  1px solid #ccc;  
            background-color: #eee;  
        }

#prev, #next
{
            position: absolute;
            z-index: 20;
            width: 51px;
            height: 68px;
            cursor: pointer;
            top: 250px;
}

#prev
{
            left: 0%;
            background-image: url("img_2/prev_button.png");
            background-position: 0 0;
            background-repeat: no-repeat;
}

#next
{
            right: 0%;
            background-image: url("img_2/next_button.png");
            background-position: 0 0;
            background-repeat: no-repeat;
}
</style>

图片

<body>
<div class="container">
    <div class="content">



    <div class="pics"> 
    <img src="img/1.jpg" width="950" height="540"  />
    <img src="img/1a.jpg" width="950" height="540"  />
    <img src="img/1.jpg"  width="950" height="540"  />
    <img src="img/2.jpg" width="950" height="540"  />
    <img src="img/3.jpg" width="950" height="540"  />

<!-- end .pics --></div> 

<!-- end .content --></div>
    <div id="prev"></div>
    <div id="next"></div>
    <div id="nav"></div>
<!-- end .container --></div>


</body>

最佳答案

希望对你有帮助,提到内容div的宽度,然后添加边距为0和auto。

.content {   
         width:950px;  
        position:relative;
        margin:0 auto;    
        padding: 10px 0;

   }


   .pics {     
        width: 100%;
        margin:0 auto;
    } 

关于JQuery Cycle,图像中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20047457/

相关文章:

jquery - 如果链接仅显示源代码并将其连接到我的 html,如何下载 Jquery

c# - MVC3 中带有搜索过滤器的 ajax 分页

javascript - 打开选项卡的计数 - Jquery

php - 在网格中平铺缩略图

html - 可点击的 <article> 背景色

Blueimp 的 jQuery 文件上传 : hide existings files

javascript - 如何在同一类、id 和名称中的字段中获取最高值文本?

html - 带有固定边栏的页面滚动

html - HTML 和 CSS 宽度属性有什么区别?

javascript - 页面加载后 Bootstrap 总是改变元素在手机上的绝对位置