如何将公牛放入css圈内

时间:2016-07-12 10:20:13

标签: html css radio-button vertical-alignment

我需要创建一个内部有几个圆圈的线条,这些圆圈内有一个圆点。它们应该看起来像单选按钮 - 如何垂直对齐点?

JSfiddle

HTML

<div class="round" id="round-vertically">
                <div class="circle img1" id="circle-star"><span>&bull;</span></div>
                <div class="circle-line"></div>
                <div class="circle img2" id="circle-key"><span>&bull;</span></div>
                <div class="circle-line"></div>
                <div class="circle img3" id="circle-cursor"><span>&bull;</span></div>
                <div class="circle-line"></div>
                <div class="circle img4" id="circle-mobile"><span>&bull;</span></div>
</div>

5 个答案:

答案 0 :(得分:2)

不要使用字符,请用css创建:

<强> HTML:

<div class="eye"></div>

<强> CSS:

.eye{
  border: 2px solid red;
  border-radius: 100%;
  position: relative;
  width: 2em; height: 2em;
}
.eye::before{
  content: "";
  display: block;
  position: absolute;
  width: 1em; height: 1em;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: red;
  border-radius: 100%;
}

http://codepen.io/anon/pen/ZOaBKg

答案 1 :(得分:0)

Flexbox可以做到这一点:

.circle {
  width: 15px;
  height: 15px;
  border: 1px #d3d4de solid;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

&#13;
&#13;
.circle-line {
  width: 1px;
  background-color: #d3d4de;
  height: 191px;
  margin: auto;
}
.circle {
  width: 15px;
  height: 15px;
  border: 1px #d3d4de solid;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}
#round-vertically {
  padding-top: 95px;
}
#round-vertically SPAN {
  color: #d3d4de;
  text-align: center;
  font-size: 30px;
}
.circle {
  border-radius: 50%;
}
&#13;
<div class="round" id="round-vertically">

  <div class="circle img1" id="circle-star"><span>&bull;</span>
  </div>
  <div class="circle-line"></div>
  <div class="circle img2" id="circle-key"><span>&bull;</span>
  </div>
  <div class="circle-line"></div>
  <div class="circle img3" id="circle-cursor"><span>&bull;</span>
  </div>
  <div class="circle-line"></div>
  <div class="circle img4" id="circle-mobile"><span>&bull;</span>
  </div>


</div>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

在课程'圈'中添加text-align:center。使用line-height属性line-height: 50%。见下面的代码:

.circle-line {
  width: 1px;
  background-color: #d3d4de;
  height: 191px;
  margin: auto;
}

.circle {  
  width: 15px;
  height: 15px;
  border:1px #d3d4de solid;
  margin: auto;
  text-align: center;
}
#round-vertically {
  padding-top:95px;

}
#round-vertically	SPAN {
  color: #d3d4de;

  font-size:30px;
  line-height: 50%
}
.circle {
  border-radius: 50%;
}
<div class="round" id="round-vertically">

					<div class="circle img1" id="circle-star"><span>&bull;</span></div>
					<div class="circle-line"></div>
					<div class="circle img2" id="circle-key"><span>&bull;</span></div>
					<div class="circle-line"></div>
					<div class="circle img3" id="circle-cursor"><span>&bull;</span></div>
					<div class="circle-line"></div>
					<div class="circle img4" id="circle-mobile"><span>&bull;</span></div>
					

				</div>

答案 3 :(得分:0)

一种方法是使用翻译 css属性

#round-vertically   SPAN {
color: #d3d4de;
font-size:30px;
left: 50%;
position: absolute;
font-size: 30px;
top: 50%;
transform: translate(-50%,-50%);
}

更新了fiddle

答案 4 :(得分:0)

您可以尝试以下代码:

Working demo

.circle {  
    width: 15px;
    height: 15px;
    border:1px #d3d4de solid;
    margin: auto;
    position:relative;

}
#round-vertically   SPAN {
  color: #d3d4de;
  text-align:center;
  font-size:30px;
  position:absolute;
  top:50%; left:50%;
  transform: translate(-50%, -50%);
}