我如何用CSS做到这一点?

时间:2015-06-03 21:37:58

标签: css

如何在CSS中创建1,2,3?如果我只是包含一个图像,这将是微不足道的,但我有兴趣完全使用CSS。

Screenshot

2 个答案:

答案 0 :(得分:2)

我为您的请求创建了一个演示:

<div class="form-group">
    <div class="circle" style="float:left">1</div>
    <div class="circle" style="float: right;">3</div>
    <div class="circle">2</div>
</div>

.form-group {
    background:linear-gradient(to top,#cccccc,#cccccc) repeat-x center;
    background-size:2px 2px;
    min-width:40px;
    text-align: center;
    line-height: 40px;


}
.circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border:1px solid #CCCCCC;
    background: white;
    margin:auto;
}

jsfiddle demo

答案 1 :(得分:0)

不是最好的方式,但也许它可以激励你

&#13;
&#13;
.wrapper {
  margin-top: 20px;
  width: 464px;
}
.wrapper::before {
  position: relative;
  top: 9px;
  display: block;
  height: 1px;
  content: "";
  background-color: black;
  z-index: -1;
}
span {
  display: inline-block;
  height: 16px;
  width: 16px;
  border: 1px solid black;
  border-radius: 16px;
  text-align: center;
  background-color: white;
}
span:nth-child(2),
span:nth-child(3) {
  margin-left: 200px;
}
&#13;
<div class="wrapper">
  <span>1</span>
  <span>2</span>
  <span>3</span>
</div>
&#13;
&#13;
&#13;