使用display:flex;并证明 – 内容:间隔;在父div上.如果您不希望它与图像一起居中,也可以将.total_votes移出评级.
这样您就不必担心给他们保证金了.
.ratings {
border: 1px solid #CCC;
overflow: visible;
padding: 10px;
position: relative;
width: 100%;
height: 100px;
display:flex;
align-items:center;
justify-content:space-between;
}
.ratings_stars {
background: url('http://www.chinabuddhismencyclopedia.com/en/images/thumb/b/b8/Nature.jpg/240px-Nature.jpg') no-repeat;
float: left;
height: 28px;
padding: 2px;
width: 32px;
}
.ratings_vote {
background: url('http://images.financialexpress.com/2015/12/Lead-image.jpg') no-repeat;
}
.ratings_over {
background: url('http://images.financialexpress.com/2015/12/Lead-image.jpg') no-repeat;
}
.total_votes {
background: #eaeaea;
padding: 5px;
}