首页 > 解决方案 > 如何在反馈星之间添加空格?

问题描述

我使用 HTML 和 CSS 创建了五个反馈星。下面是相同的图像。

在此处输入图像描述

如您所见,星星彼此之间的距离太近了。我想在星星之间应用一些空间。我已经使用了边距,填充了所有内容。但没有任何工作。下面是代码:

.ratings {
  position: relative;
  vertical-align: middle;
  display: inline-block;
  color: #b1b1b1;
  overflow: hidden;
}

.full-stars {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  overflow: hidden;
  color: #fde16d;
}

.empty-stars:before,
.full-stars:before {
  content: "\2605\2605\2605\2605";
  font-size: 14pt;
}

.empty-stars:before {
  -webkit-text-stroke: 1px #848484;
}

.full-stars:before {
  -webkit-text-stroke: 1px orange;
}


/* Firefox */

@-moz-document url-prefix() {
  .full-stars {
    color: #ECBE24;
  }
}
<div class="ratings">
  <div class="empty-stars"></div>
  <div class="full-stars" style="width:70%"></div>
</div>

下面是工作小提琴: https ://jsfiddle.net/4qqspqxh/862/

你能帮我在星星之间做一些差距吗?

标签: htmlcss

解决方案


尝试这个:

.empty-stars:before, .full-stars:before {
   content: "\2605\2605\2605\2605";
   font-size: 14pt;
   letter-spacing: 4pt;
}

推荐阅读