Подтвердить что ты не робот

Как нарисовать горизонтальную линию между двумя кругами с помощью CSS?

Как нарисовать горизонтальную линию между двумя кругами в CSS?

Он должен быть посередине, как показано на скриншоте.

Пример здесь:

enter image description here

Я нарисовал 2 круга, но не знаю, как их соединить.

#status-buttons a {
  color: black;
  display: inline-block;
  font-size: 17px;
  font-weight: normal;
  margin-right: 0;
  text-align: center;
  text-transform: uppercase;
  min-width: 150px;
  text-decoration: none;
}
#status-buttons a:hover {
  text-decoration: none;
}
#status-buttons a.active span {
  color: white;
  background: #ACCF5B;
  box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
  color: white;
  background: #22bacb;
  display: block;
  height: 45px;
  margin: 0 auto 10px;
  padding-top: 20px;
  width: 60px;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
<div id="status-buttons" class="text-center">
  <a href="#/form/regalo" class="active"><span>1</span> Step 1</a>
  <a href="#/form/tusdatos"><span>2</span> Step 2</a>
</div>
4b9b3361

Ответ 1

Вы можете использовать псевдоэлемент, чтобы вставить абсолютно расположенную границу:

#status-buttons {
  position: relative;          /* 1 */
  display: inline-block;       /* 2 */
}
#status-buttons::after {       /* 3 */
  content: "";
  position: absolute;
  width: 50%;
  z-index: -1;                 /* 4 */
  top: 35%;
  left: 25%;
  border: 3px solid #ACCF5B;
}
#status-buttons a {
  color: black;
  display: inline-block;
  font-size: 17px;
  font-weight: normal;
  margin-right: 0;
  text-align: center;
  text-transform: uppercase;
  min-width: 150px;
  text-decoration: none;
}
#status-buttons a:hover {
  text-decoration: none;
}
#status-buttons a.active span {
  color: white;
  background: #ACCF5B;
  box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
  color: white;
  background: #22bacb;
  display: block;
  height: 45px;
  margin: 0 auto 10px;
  padding-top: 20px;
  width: 60px;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
<div id="status-buttons" class="text-center">
  <a href="#/form/regalo" class="active"><span>1</span> Step 1</a>
  <a href="#/form/tusdatos"><span>2</span> Step 2</a>
</div>

Ответ 2

Вы можете добавить новый элемент и поместить его между двумя кругами:

#status-buttons a {
    color: black;
    display: inline-block;
    font-size: 17px;
    font-weight: normal;
    margin-right: 0;
    text-align: center;
    text-transform: uppercase;
    min-width: 150px;
    text-decoration: none;
}

#status-buttons a:hover {
  text-decoration: none;
}
    
#status-buttons a.active span {
    color: white;
    background: #ACCF5B;
    box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}

#status-buttons span {
    color: white;
    background: #22bacb;
    display: block;
    height: 45px;
    margin: 0 auto 10px;
    padding-top: 20px;
    width: 60px;
    border-radius: 50%;
    box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}

#line {
  position: absolute;
  top: 42px;
  left: 112px;
  width: 96px;
  height: 5px;
  background: #ACCF5B;
}
<div id="status-buttons" class="text-center">
                <a href="#/form/regalo" class="active"><span>1</span> Step 1</a>
                <div id="line">
                </div>
                <a href="#/form/tusdatos"><span>2</span> Step 2</a>
            </div>

Ответ 3

Вот одно из решений:

https://jsfiddle.net/sfyuxrs9/

Он содержит div (который формирует строку), который имеет position: absolute и отрицательное значение z-index. Остальная часть просто регулирует все значения для ширины/высоты/верхней и левой

Ответ 4

Я думаю, вы можете сделать что-то вроде этого проверьте следующий фрагмент кода

#status-buttons a {
    color: black;
    display: inline-block;
    font-size: 17px;
    font-weight: normal;
    margin-right: 0;
    text-align: center;
    text-transform: uppercase;
    min-width: 150px;
    text-decoration: none;
}

#status-buttons a:hover {
  text-decoration: none;
}
    
#status-buttons a.active span {
    color: white;
    background: #ACCF5B;
    box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}

#status-buttons span {
    color: white;
    background: #22bacb;
    display: block;
    height: 45px;
    margin: 0 auto 10px;
    padding-top: 20px;
    width: 60px;
    border-radius: 50%;
    box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}

div.linetop { border-top: 1px solid #111111; width:95px;
position:absolute;
  top:40px;
  left:115px;
}
<div id="status-buttons" class="text-center">
                <a href="#/form/regalo" class="active"><span>1</span> Step 1</a>
 
                <a href="#/form/tusdatos"><span>2</span> Step 2</a>
            </div>


<div class="linetop"></div>

Ответ 5

Здесь вы идете.

<div id="status-buttons" class="text-center">
    <a href="#/form/regalo" class="active"><span>1</span> Step 1</a>
    <a href="#/form/tusdatos"><span>2</span> Step 2</a>
</div>
<div class="line">
</div>

CSS

 #status-buttons a {
    position: relative;
    color: black;
    display: inline-block;
    font-size: 17px;
    font-weight: normal;
    margin-right: 0;
    text-align: center;
    text-transform: uppercase;
    min-width: 150px;
    text-decoration: none;
        z-index: 1;
}

#status-buttons a:hover {
  text-decoration: none;
}

#status-buttons a.active span {
    color: white;
    background: #ACCF5B;
    box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}

#status-buttons span {
    color: white;
    background: #22bacb;
    display: block;
    height: 45px;
    margin: 0 auto 10px;
    padding-top: 20px;
    width: 60px;
    border-radius: 50%;
    box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;

}
.line {
    position: absolute;
    border-bottom: 5px solid black;
    width: 20%;
    left: 71px;
    top: 39px;
    z-index: 0;
}

https://jsfiddle.net/norcaljohnny/nwjz2010/