.ratings {
border: 1px solid #CCC;
overflow: visible;
padding: 10px;
position: relative;
width: 100%;
height: 100px;
}
.ratings_stars {
background: url('/images/rsz_star_icon_1.png') no-repeat;
float: left;
height: 28px;
padding: 2px;
width: 32px;
}
.ratings_vote {
background: url('star_voted.png') no-repeat;
}
.ratings_over {
background: url('star_overs.png') no-repeat;
}
.total_votes {
background: #eaeaea;
top: 58px;
left: 0;
padding: 5px;
position: absolute;
}
我想让divs的图像响应……而且我希望所有常常的星星都在内联.我可以这样做吗?拥有相同的保证金并保持中心的星星图标
最佳答案
使用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;
}