"category_images"には子の幅がありますので、 "category_images"は "category_images_wrapper"の "margin:0 auto"の中央に置くことができます。
現在、「category_images」は、親「category_images_wrapper」の幅を持ち、中央に配置されません。子アイテムの幅を取得してブロックを中央に配置する方法
HTML:
<center><h2>Featured Categories</h2></center>
<div class="category_images_wrapper">
<div class="category_images">
<!--First image-->
<div class="category_images_item">
<a href="">
<span>Watches</span>
<div class="category_images_img" style="background: url(https://static.pexels.com/photos/1279/fashion-wristwatch-time-watch.jpg)no-repeat center;background-size:cover;">
</div>
</a>
</div>
<!--second image-->
<div class="category_images_item">
<a href="">
<span>Gadgets</span>
<div class="category_images_img" style="background: url(https://static.pexels.com/photos/1279/fashion-wristwatch-time-watch.jpg)no-repeat center;background-size:cover;">
</div>
</a>
</div>
<!--third image-->
<div class="category_images_item">
<a href="">
<span>Headshop</span>
<div class="category_images_img" style="background: url(https://static.pexels.com/photos/1279/fashion-wristwatch-time-watch.jpg)no-repeat center;background-size:cover;">
</div>
</a>
</div>
<!--fourth image-->
<div class="category_images_item">
<a href="">
<span>test</span>
<div class="category_images_img" style="background: url(https://static.pexels.com/photos/1279/fashion-wristwatch-time-watch.jpg)no-repeat center;background-size:cover;">
</div>
</a>
</div>
<!--fifth image-->
<div class="category_images_item">
<a href="">
<span>test</span>
<div class="category_images_img" style="background: url(https://static.pexels.com/photos/1279/fashion-wristwatch-time-watch.jpg)no-repeat center;background-size:cover;">
</div>
</a>
</div>
<!--sixth image-->
<div class="category_images_item">
<a href="">
<span>teeest</span>
<div class="category_images_img" style="background: url(https://static.pexels.com/photos/1279/fashion-wristwatch-time-watch.jpg)no-repeat center;background-size:cover;">
</div>
</a>
</div>
<div style="clear: both"></div>
</div>
</div>
CSS:
.category_images_wrapper{
max-width:1050px;
margin:0 auto;
}
.category_images{
}
.category_images_item{
width: 310px;
height: 280px;
float:left;
position:relative;
background-color: black;
overflow:hidden;
transition: all 0.8s ease;
margin-left:25px;
margin-top:25px;
}
.category_images_item span{
color: white;
font-weight: bold;
font-size: 32px;
font-style: italic;
z-index: 100;
position: absolute;
width:100%;
text-align:center;
top:120px;
}
.category_images_img{
width:310px;
height:280px;
transition: all 0.8s ease;
opacity:0.7;
}
.category_images_item:hover .category_images_img{
transform: scale(1.06) rotate(-2deg);
opacity: 0.5;
}
フィドル:https://jsfiddle.net/kn05uv4k/
おかげでたくさん!
パーフェクト!まさに私が探していたもの。ありがとうalot :)) – N1njaWTF
私は助けることができてうれしい。歓声! :D –