Uncheck - .
I put the blue background just to have a sense of the container
Using display: flex;
...
#vote {
background: dodgerblue;
display: flex;
justify-content: center;
align-items: center;
}
.like {
background: url('http://plugcitarios.com/wp-content/uploads/2013/06/like.jpg') no-repeat center center;
background-position: center;
background-size: 24px 24px;
width: 24px;
height: 24px;
}
.unlike {
background: url('http://www.ironmonk.net/wp-content/uploads/2014/09/unlikefanpage.png') no-repeat center center;
background-position: center;
background-size: 24px 24px;
width: 24px;
height: 24px;
}
<span id="vote">
<a href="#">
<div class="like"></div>
</a>
<a href="#">
<div class="unlike"></div>
</a>
</span>
Now using float: left;
#vote {
background: dodgerblue;
}
.like {
background: url('http://plugcitarios.com/wp-content/uploads/2013/06/like.jpg') no-repeat center center;
background-position: center;
background-size: 24px 24px;
width: 24px;
height: 24px;
}
.unlike {
background: url('http://www.ironmonk.net/wp-content/uploads/2014/09/unlikefanpage.png') no-repeat center center;
background-position: center;
background-size: 24px 24px;
width: 24px;
height: 24px;
}
.like, .unlike {
float: left;
}
<span id="vote">
<a href="#">
<div class="like"></div>
</a>
<a href="#">
<div class="unlike"></div>
</a>
</span>
When to use float and flex
Well it depends on your audience, if most uses old browser, not many, but some people still use Internet Explorer, because it already comes installed in the Window, and
display: flex
would not be appropriate for such, as it is more for current browsers. you can take a look at the compatibility:
link
float
is good in most browsers, but it's harder to set up a layout with float
[in my opinion].
link
Tip I'm preferring flex
lately, but as I said, it depends on the circumstance.
You can see here the most used browsers in Brazil:
link
Final
Even though I would be flex
if I were you, because as you can see Internet explorer does not help much, but in compensation, most other browsers support, if not partially.