为什么我的div位置正确?

时间:2015-05-23 08:29:38

标签: html css

我的div"评分"有问题,他的立场是对的,我想把她放在左起。

我可以使用绝对位置来解决div等级,但这不是成功解决方案。

http://jsfiddle.net/uw4srwLy/

HTML

<div class="rating">
<span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
</div>

CSS

.rating > span:hover:before {
   content: "\2605";
   position: absolute;
}
.rating {
  unicode-bidi: bidi-override;
  direction: rtl;
}
.rating > span:hover:before,
.rating > span:hover ~ span:before {
   content: "\2605";
   position: absolute;
}
.rating {
  unicode-bidi: bidi-override;
  direction: rtl;
}
.rating > span {
  display: inline-block;
  position: relative;
  width: 1.1em;
}
.rating > span:hover:before,
.rating > span:hover ~ span:before {
   content: "\2605";
   position: absolute;
}

1 个答案:

答案 0 :(得分:1)

将评级div浮动到左侧。

.rating {
  direction: rtl;
  float: left;
  unicode-bidi: bidi-override;
}