Reputation: 3378
I have a dynamically created list of <a>
tags (without text) to which I apply a background image. I display these icons within <div>
container using the float: left;
style.
When the row of icons becomes too long it overflows and begins a new row as expected.
How can I either center this last row, or spread the icons out evenly across the row?
Upvotes: 0
Views: 57
Reputation: 2157
Cool..so for centering the row, this is what you need : http://jsbin.com/uPeYaJE/1/edit
Screencapture:
CSS:
.container{
width:200px;
background-color:#666666;
overflow:auto;
text-align:center;
}
.container a{
display:inline-block;
background: url('http://placekitten.com/34/34');
background-repeat:no-repeat;
background-size: 100%;
width: 34px;
height: 34px;
}
HTML:
<div class="container">
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
</div>
Upvotes: 1