Css3响应圆圈由线连接? [英] Css3 responsive circles connected by a line?

查看:149
本文介绍了Css3响应圆圈由线连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您正在尝试使用css3创建一个使用响应式圆形连接的div。

Hi Im trying to create a div with responsive circles connected by a line using css3.

尝试执行的示例 http://codepen.io/bookcasey/pen/cEntL

在上面的例子中,我想让它响应,使得圆的大小不会改变,但如果宽度增加,我想要第一个和最后一个圆圈在UL的左侧和右侧,其他圆圈之间的位置在相等的距离。

In the above example i want to make it responsive such that the circle size doesnot change but if width increases i want first and last circles to be on left side and right side of the UL and other circles position in between at equal distances. circles can increase or decrease least is two circles and a line.

推荐答案

您可以使用调整div的最后一行?以使其全宽。

You could use the solution of Justify the last line of a div? in order to make it full width.

假定有绝对定位伪元素的行。

And fake the line with absolute positioned pseudo-elements.

演示

ul {
  text-align: justify;
  position: relative;
  overflow: hidden;
}
ul:before, .active:after {
  content: '';
  width: 100%;
  border: 2px solid dodgerblue;
  position: absolute;
  top: 1em;
  margin-top: -2px;
  z-index: -1;
}
.active:after {
  border-color: lightblue;
}
ul:after {
  content: "";
  display: inline-block;
  width: 100%;
}
li {
  width: 2em;
  height: 2em;
  text-align: center;
  line-height: 2em;
  border-radius: 50%;
  background: dodgerblue;
  margin: 0 1em;
  display: inline-block;
  color: white;
}
.active ~ li {
  background: lightblue;
}
body {
  font-family: sans-serif;
  padding: 2em;
}

这篇关于Css3响应圆圈由线连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆