javascript - 创建由线连接到一个主圆的 CSS 圆

标签 javascript html css user-interface web

circle example

我需要创建一个如图所示的页面。

绿色的主圆必须使用 css 和 html 连接到 2 个子圆。请提供解决方案。

最佳答案

.left-box,
.right-box {
  vertical-align: middle;
  display: inline-block;
}

.left-box {
  margin-right: 50px;
}

.right-box .circle + .circle {
  margin-top: 20px;
}

.circle {
  border-radius: 100%;
  background: #ed1c24;
  text-align: center;
  position: relative;
  display: table;
  height: 70px;
  z-index: 10;
  color: #fff;
  width: 70px;
}

.big-circle {
  background: #52883b;
  height: 100px;
  width: 100px;
}

.purple {
  background: #ec008c;
}

.circle .circle-content {
  vertical-align: middle;
  display: table-cell;
}

.circle.one:before,
.circle.two:before {
  transform: rotate(-20deg);
  position: absolute;
  margin: 0 -5px 0 0;
  background: #000;
  width: 74px;
  content: '';
  height: 1px;
  right: 100%;
  z-index: -1;
  top: 50%;
}

.circle.two:before {
  transform: rotate(20deg);
}
<div class="left-box">
  <div class="big-circle circle">
    <div class="circle-content">1</div>
  </div>
</div>
<div class="right-box">
  <div class="circle one">
    <div class="circle-content">1.1</div>
  </div>
  <div class="circle purple two">
    <div class="circle-content">1.2</div>
  </div>
</div>

关于javascript - 创建由线连接到一个主圆的 CSS 圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37432832/

相关文章:

javascript - Backbone.js 中的命名空间

html - 如何阻止 Flash 重叠弹出内容

jquery - CSS :focus Not Working in iOS

javascript - 在 Firebase 中为推送的项目设置名称

javascript - 消息框和负载掩码

javascript - 如何仅在移动 View 中加载 CSS?

javascript - 带有图例的多线图的工具提示单击 d3.js

javascript - 带有隐藏 overflow-x 的父级的 div 上的编程滚动

python - 平面 HTML 页面的搜索索引

javascript - Html/Css 透明 iframe