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 attach a progress bar as a border to div

In React I need to attach a linear progress bar as a bottom to div. I tried with a normal linear progress bar and attached the linear progress to the end of the div with the flex-end property. Below is the code sandbox link for my implementation.

Code Sandbox Link:-https://codesandbox.io/s/linear-progress-bar-forked-udhxqz

But my requirement is the div should be as per the below screenshot
SCREENSHOT WITH BRODER 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

How can I achieve the below div with HTML and CSS changes?I should implement using in ReactJS

>Solution :

I was able to get your example working with a few CSS changes, below are the only two parts I needed to change:

.App {
  overflow: hidden;
}

.emptyProgressBar {
  border-radius: 0px;
}

.fillingProgressBar {
  width: 102%;
}

Then in App.tsx, change your left style to -101, like the following:

left: props.percent - 101 + "%",

A working example forked from your sandbox is available here.

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