简体   繁体   English

圆圈之间的HTML线

[英]HTML Line between circles

I am trying to achieve something like this: 我正在尝试实现以下目标:

在此处输入图片说明

But this is what I've managed to do. 但这是我设法做到的。

在此处输入图片说明

Could you please help me to achieve desired result? 您能帮我达到预期的效果吗?

UPDATE: 更新:

Problem goes away if I remove bootstrap.css dependency. 如果我删除bootstrap.css依赖关系,问题就消失了。 How can I make it work with bootstrap? 如何使它与引导程序一起使用?

CodePen (add bootstrap.css in the settings to see an issue) CodePen (在设置中添加bootstrap.css以查看问题)

 .time-slice { display: flex; align-items: stretch; } .time-slice > * { padding: 20px; } .circle { width: 16px; height: 16px; background: #ffffff; border-radius: 32px; display: block; border: 2px solid #1A87B9; } .circle-wrap { position: absolute; } .circle-wrap > .circle { position: relative; left: -30px; } .date-time { flex-shrink: 0; flex-basis: 60px; } .date, .time { max-width: 90px; color: #999999; font-size: 13px; margin-top: 0; margin-bottom: 10px; } .point-title { border-left: 2px solid #1A87B9; } 
 <div id="ticketDetails"> <h1>Details</h1> <div class="time-slice row"> <div class="date-time"> <p class="time">10h 30min</p> <p class="date">&nbsp;</p> </div> <div class="circle-wrap"> <div class="circle"></div> </div> <div class="point-title"> <span> <b>Amsterdam (Schiphol)</b> </span> </div> </div> <div class="time-slice row"> <div class="date-time"> <p class="date">Fri 28 Aug</p> <p class="time">20:00</p> </div> <div class="circle-wrap"> <div class="circle"></div> </div> <div class="point-title"> <span> <b>Manchester (MAN)</b> </span> </div> </div> </div> 

The problem is in * {box-sizing: border-box} used by Bootstrap. 问题出在Bootstrap使用的* {box-sizing: border-box} Simply either set default box-sizing: content-box for .circle ( fixed codepen demo ) or take this property setting of the BS into account when you size/align your stuff. 只需设置默认的box-sizing: content-box .circle box-sizing: content-box固定codepen demo ),或在调整大小/对齐内容时考虑BS的此属性设置。

change 更改

.circle-wrap {
  position: absolute;
  > .circle {
    position: relative;
    left: -30px;
  }
}

to

.circle-wrap {
  position: absolute;
  & > .circle {
    position: relative;
    left: -30px;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM