Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making two circles to come on top of the vertical line in CSS

Tags:

html

css

I want to make the orange and the blue circles on the top of the line going in-between.

.content-wrap {
  border-left: 1px dashed black;
  height: 5em;
  position: absolute;
}

.content-wrap::before {
  position: absolute;
  top: calc(50% - 1px);
  right: 0;
  left: 0;
  Content: "";
  border: none;
  height: 2px;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="content-wrap">
  <font-awesome-icon class="icon1" fixed-width icon="dot-circle" />
  <font-awesome-icon class="icon2" fixed-width icon="map-marker-alt" />
</div>

Current output:

Refer to the above image

Desired Output:

enter image description here

like image 508
Pheonix Avatar asked Nov 06 '22 05:11

Pheonix


People also ask

How do you outline a circle in CSS?

To create a circle we can set the border-radius on the element. This will create curved corners on the element. If we set it to 50% it will create a circle. If you set a different width and height we will get an oval instead.

How do I add a vertical separator line in CSS?

Answer: Use the CSS border Property You can use the CSS border property on a <span> element in combination with the other CSS property like display and height property to make vertical lines in HTML.


1 Answers

I did not use befoe:: effect.see if this helps.

.content-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min-content;
  margin: 0 auto;
  padding: 2rem;
  border-radius: 0.25rem;
  background: #3e3e3e;
}

.circle {
  color: pink;
  font-size: 1.25rem;
}

.dotted {
  border-left: 0.125rem dashed #f0f0f0;
  height: 8rem;
}

.marker {
  color: lightblue;
  font-size: 1.25rem;
}
<script src="https://kit.fontawesome.com/a076d05399.js"></script>

<body>
  <div class="content-wrap">
    <i class="fas fa-dot-circle circle"></i>
    <div class="dotted"></div>
    <i class="fa fa-map-marker marker" aria-hidden="true"></i>
  </div>
</body>
like image 76
ino Avatar answered Nov 15 '22 13:11

ino