The solution is to set your div to display: inline-block.