By default, <div>
elements are block-level
meaning they are one-per-line and will expand horizontally to fill their container.
Adding the click handling is another problem. You could include the <a>
and <img>
elements in the uparrow
and downarrow
elements or you do it in CSS as you suggested (the less compatible way). Another option is registering DOM events with Javascript.
HTML:
<div class="vote">
<div class="uparrow" />
<div class="downarrow" />
</div>
CSS:
div.vote {
width: 50px;
float: left;
}
div.uparrow {
background-image: url(...);
}
div.downarrow {
background-image: url(...);
}