Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add solid line between word or sentence? HTML CSS

I was wondering how to add these lines between words/sentences as I saw many of solution involve the border-bottom-line or js. I was just curious that can these lines be done simply just using a span or div(containing line and sentence) or something else. I’ve try but I wonder there is way that is better than mine.

click to see image example

.ll{
  display: flex;
  flex-direction: row;
}
<div class="ll">
  <span> one </span>
  <span>-</span>
  <span> two </span>
  <span>-<span>
  <span> three </span>
</div>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you can do it with pseudo elements.

.ll{
  display: flex;
  flex-direction: row;
}
span:after{
  content: '';
  display: inline-block;
  width: 15px;
  height: 4px;
  border-top: 2px solid red;
  margin: 0 10px;
}
span:last-child:after{
  width: 0;
  margin: 0;
}
<div class="ll">
  <span> one </span>
  <span> two </span>
  <span> three </span>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading