Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical line with dots in ends and between

Tags:

css

I have been searching for a solution for this both here, and on google with no success.

I want to create a Vertical line which has dots in the ends and a few along the line.

img for example:

horizontal line with dots

how can I achieve this with css ? I can do a dotted line with spacing, but I have no idea how to create the line also, and if that is even possible ?

like image 617
andrelange91 Avatar asked Jan 25 '17 07:01

andrelange91


People also ask

What does a vertical line look like?

What is a vertical line? A vertical line is a line extending up and down. On a table (like the one shown to the right), the legs of the table are vertical lines. The y-axis is an example of a vertical line.

How do you put a vertical line between two divs in HTML?

You can use <hr> , as it is semantically correct, and then use CSS to convert it to a vertical line.

How do you create a line in CSS?

Its simple to add a horizontal line in your markup, just add: <hr>. Browsers draw a line across the entire width of the container, which can be the entire body or a child element.


1 Answers

Here's a quick snippet that might help you with your problem:

.bar {
  list-style: none;
}
.bar >li {
  position: relative;
}
.bar>li:before {
  content: '\25CF';
  margin-right: 10px;
  font-size: 20px;
}
.bar>li:after {
  position: absolute;
  left: 0;
  top: 0;
  content: '';
  border-left: 2px solid black;
  margin-left: 5px;
  height: 100%;
}
.bar >li:first-of-type:after {
  top: 50%;
}
.bar >li:last-of-type:after {
  top: -50%;
}
<ul class="bar">
  <li>element 1</li>
  <li>element 2</li>
  <li>element 3</li>
  <li>element 4</li>
  <li>element 5</li>
</ul>

The idea is that you use a list and each element's bullet is replaced with a :before symbol of a Unicode black circle, while each :after selector for the elements contains the element's share of the vertical line. The first and last list elements have an extra rule to truncate their border-line, so that it does not go past the black circle.

Tweak it a bit to get the exact effect you want!

like image 144
Angelos Chalaris Avatar answered Sep 17 '22 04:09

Angelos Chalaris