I have started to create bootstrap progress bar with custom colors etc. however there appears grey border above progress bar and I am unable to understand where this border comes from and how to remove it.
CSS:
.progress-info {
color: #ffffff;
}
.progress-info {
padding-top: 34px;
background-color: #005861;
}
.progress {
background-color: #F3723F;
border: 5px solid #F3723F;
border-radius: 4px;
height: 18px;
}
.progress-second {
background-color: #45BDA1;
border: 5px solid #45BDA1;
}
Html:
<div class="progress-info" data-bind="with: $data.statistics">
<div class="row">
<div class="col-md-4">Your score</div>
<div class="progress col-md-6">
<div class="progress-bar progress-bar-score" role="progressbar" aria-valuemin="0" aria-valuemax="100" data-bind="style: {width: $data.score}" style="width: 6%;"></div>
</div>
<div class="col-md-2" data-bind="text: $data.score">6%</div>
</div>
<div class="row">
<div class="col-md-4">Progress</div>
<div class="progress progress-second col-md-6">
<div class="progress-bar progress-bar-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" data-bind="style: {width: $data.score}" style="width: 6%;"></div>
</div>
<div class="col-md-2"><span data-bind="text: $data.success_cnt">2</span> / <span data-bind="text: $data.attempts">35</span>
</div>
</div>
</div>
JsFiddle
That is not a border. It is a box-shadow. You only need to give box-shadow: none; to the .progress.
Jsfiddle
.progress {
height: 20px;
margin-bottom: 20px;
overflow: hidden;
background-color: #f5f5f5;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
box-shadow: none;
}
Related
I just started to FE after a couple of years in BE.
Developing an analytics card with using Angular on FE and .net Core on BE.
Stucked on a point to find out the best practice about to change background-color: property of a class beneath of main class.
<div class="row">
<div class="journey-card-bottom">
<div *ngFor="let bottom of top.breakDown | keyvalue: originalOrder">
<div>
<span>{{bottom.key}}</span>
</div>
<div class="row">
<div class="col-lg-10">
<div class="progress">
<div class="progress-bar" role="progressbar"
[ngStyle]="{'width': bottom.value > 0 ? bottom.value + '%' : '8px'}"></div>
<span class="percentage-value">{{bottom.value}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
Screenshot to the desired outcome
In my CSS;
.journey-card-bottom {
border: 1px solid #DADCDD;
box-sizing: border-box;
padding: 10px;
line-height: 3;
width: 100%;
height: 435px;
}
.progress {
background-color: white !important;
margin-top: 5px;
}
.progress-bar {
border-radius: 0.25rem;
height: 8px;
align-self: center;
background-color: #0B4886;
}
.journey-card-bottom .progress-bar:nth-of-type(1) {
background-color: #68D391;
}
.journey-card-bottom .progress-bar:nth-of-type(2) {
background-color: #FCAF65;
}
It seems :nth-of-type(1) changes the background color but not only for 1st bar, for all of them.
:nth-of-type(2)does not effect at all i guess because there is no direct parent-child relation between each other.
On the other hand i know i can achieve with using [ngStyle] based on the item index in [ngFor] however i'm not sure if it's the best practice or not.
:nth-of-type() applies to sibling elements. Since .progress-bar is the first sibling within .progress and has no other siblings with the class .progress-bar, only the styles declared in .journey-card-bottom .progress-bar:nth-of-type(1) will be applied. Here is a code snippet showing your CSS working by changing the HTML structure:
.journey-card-bottom {
border: 1px solid #DADCDD;
box-sizing: border-box;
padding: 10px;
line-height: 3;
width: 100%;
height: 435px;
}
.progress {
background-color: white !important;
margin-top: 5px;
}
.progress-bar {
border-radius: 0.25rem;
height: 8px;
align-self: center;
background-color: #0B4886;
}
.journey-card-bottom .progress-bar:nth-of-type(1) {
background-color: #68D391;
}
.journey-card-bottom .progress-bar:nth-of-type(2) {
background-color: #FCAF65;
}
<div class="journey-card-bottom">
<div class="progress">
<div class="progress-bar" role="progressbar"></div>
<span class="percentage-value">90</span>
<div class="progress-bar" role="progressbar"></div>
<span class="percentage-value">60</span>
</div>
</div>
To solve your issue, I would suggest using :nth-of-type() on the top-level element of the for loop. In the below example, the top-level element has the class .target-class:
.journey-card-bottom {
border: 1px solid #DADCDD;
box-sizing: border-box;
padding: 10px;
line-height: 3;
width: 100%;
height: 435px;
}
.progress {
background-color: white !important;
margin-top: 5px;
}
.progress-bar {
border-radius: 0.25rem;
height: 8px;
align-self: center;
background-color: #0B4886;
}
.target-class:nth-of-type(1) .progress-bar {
background-color: #68D391;
}
.target-class:nth-of-type(2) .progress-bar {
background-color: #FCAF65;
}
<!-- Rendered HTML from the component -->
<div class="row">
<div class="journey-card-bottom">
<div class="target-class">
<div>
<span>Passed</span>
</div>
<div class="row">
<div class="col-lg-10">
<div class="progress">
<div class="progress-bar" role="progressbar"></div>
<span class="percentage-value">90</span>
</div>
</div>
</div>
</div>
<div class="target-class">
<div>
<span>Referred</span>
</div>
<div class="row">
<div class="col-lg-10">
<div class="progress">
<div class="progress-bar" role="progressbar"></div>
<span class="percentage-value">60</span>
</div>
</div>
</div>
</div>
</div>
</div>
I have an angular 10 project, where I have to align 3 cards in a row, so far they align horizontally in a row, but I have to give them some spacing which did not work that much till now.
I tried to do it with offset variable of bootstrap and manually giving them margin and padding but still no luck. In mobile phone it works perfectly fine with spacing just not in desktop. Here is my code could someone look at it and point me my mistake out?
What I tried so far:
setting margin and padding manually -> did not work no effect at
all.
using offset variable of bootstrap -> no changes.
using flex parameter -> also no changes
card component.html
<section>
<div class="row ">
<div class="col-xl-4 col-md-4 my-4 ">
<mdb-card cascade="true" class="cascading-admin-card">
<div class="admin-up">
<mdb-icon fas icon="money-bill-alt" class="primary-color"></mdb-icon>
<div class="data">
<p>SALES</p>
<h4><strong>$2000</strong></h4>
</div>
</div>
<mdb-card-body [cascade]="true">
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p class="card-text">Better than last week (25%)</p>
</mdb-card-body>
</mdb-card>
</div>
</div>
</section>
my scss for this component:
.cascading-admin-card {
margin-top: 20px;
float: left;
width:18rem;
}
.cascading-admin-card .admin-up {
margin-left: 4%;
margin-right: 4%;
margin-top: -20px;
padding-top: 5px;
}
.cascading-admin-card .admin-up mdb-icon {
padding: 1.7rem;
font-size: 2rem;
color: #fff;
text-align: left;
margin-right: 1rem;
border-radius: 3px;
box-shadow: 0 2px 9px 0 rgba(0,0,0,.2),0 2px 13px 0 rgba(0,0,0,.19); }
.cascading-admin-card .admin-up .data {
float: right;
margin-top: 2rem;
text-align: right; }
.cascading-admin-card .admin-up .data p {
color: #999999;
font-size: 12px; }
.classic-admin-card .card-body {
color: #fff;
margin-bottom: 0;
padding: 0.9rem; }
.classic-admin-card .card-body p {
font-size: 13px;
opacity: 0.7;
margin-bottom: 0; }
.classic-admin-card .card-body h4 {
margin-top: 10px; }
.classic-admin-card .card-body .float-right .fa {
font-size: 3rem;
opacity: 0.5; }
.classic-admin-card .progress {
margin: 0;
opacity: 0.7; }
.cascading-admin-card .admin-up .fa {
-webkit-box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
}
And the main dashboard where I use this element:
<div class="main-content justify-content-center" style="padding-top: 50px; align-content: center">
<div class="container">
<div class="row row-cols-12 row-cols-md-3">
<div class="col mb-4">
<moniesta-client-card-info></moniesta-client-card-info>
</div>
<div class="col mb-4">
<moniesta-client-card-info></moniesta-client-card-info>
</div>
<div class="col mb-4">
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</div>
</div>
</div>
Here is the images of what I get when I give my code flex:
and this is mobile:
I want to achieve two things first in desktop I want the cards to start next with a bit of space to the sidebar.
And be responsive
My code looks like this:
<div class="main-content " style="padding-top: 50px; align-content: center">
<div class="container">
<div class="d-inline-flex">
<section class="col-4">
<div >
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</section>
<section class="col-4">
<div >
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</section>
<section class="col-4">
<div >
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</section>
</div>
</div>
</div>
Your question needs improvements.
As long as your question concerns a CSS or HTML issue, try to provide the compiled expected result as HTML, without your angular formatting.
I do not know how your angular component is acting. So I maybe made some errors in my interpretation below. However, I suggest you to learn how bootstrap cards are built.
Here is an example with header, body and footer within card :
<div class="card text-center">
<div class="card-header">
My header
</div>
<div class="card-body">
<h5 class="card-title">A title in the body</h5>
<p class="card-text">A card text</p>
</div>
<div class="card-footer text-muted">
A text in footer which is muted
</div>
</div>
Then in your row component, you have 3 col elements, where you bind your cards. You may consider moving the mb-4 class to the row wrapper, and removing it from your cols.
Then in your card component, I think you have too much rules, and may consider clarifying it. Have a look on my interpretation below. I made the first card a little bit different than the two others to let you see how a bootstrap card could be implemented.
See your code with the built-in stackoverflow js/html/css snippet
.cascading-admin-card {
margin-top: 20px;
float: left;
width:18rem;
}
.cascading-admin-card .admin-up {
margin-left: 4%;
margin-right: 4%;
margin-top: -20px;
padding-top: 5px;
}
.cascading-admin-card .admin-up mdb-icon {
padding: 1.7rem;
font-size: 2rem;
color: #fff;
text-align: left;
margin-right: 1rem;
border-radius: 3px;
box-shadow: 0 2px 9px 0 rgba(0,0,0,.2),0 2px 13px 0 rgba(0,0,0,.19); }
.cascading-admin-card .admin-up .data {
float: right;
margin-top: 2rem;
text-align: right; }
.cascading-admin-card .admin-up .data p {
color: #999999;
font-size: 12px; }
.classic-admin-card .card-body {
color: #fff;
margin-bottom: 0;
padding: 0.9rem; }
.classic-admin-card .card-body p {
font-size: 13px;
opacity: 0.7;
margin-bottom: 0; }
.classic-admin-card .card-body h4 {
margin-top: 10px; }
.classic-admin-card .card-body .float-right .fa {
font-size: 3rem;
opacity: 0.5; }
.classic-admin-card .progress {
margin: 0;
opacity: 0.7; }
.cascading-admin-card .admin-up .fa {
-webkit-box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
}
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" rel="stylesheet"/>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="main-content justify-content-center" style="padding-top: 15px; align-content: center">
<div class="container">
<div class="row">
<div class="col">
<div class="card cascading-admin-card">
<div class="card-header">
<i class="fas fa-money-bill-alt primary-color"></i>
SALES
</div>
<div class="card-body">
<h5 class="card-title">$2000</h5>
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
<div class="card-footer text-muted">
Better than last week (25%)
</div>
</div>
</div>
<div class="col">
<div class="card cascading-admin-card">
<div class="admin-up">
<i class="fas fa-money-bill-alt primary-color"></i>
<div class="data">
<p>SALES</p>
<h4><strong>$2000</strong></h4>
</div>
</div>
<div class="card-body">
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p class="card-text">Better than last week (25%)</p>
</div>
</div>
</div>
<div class="col">
<div class="card cascading-admin-card">
<div class="admin-up">
<i class="fas fa-money-bill-alt primary-color"></i>
<div class="data">
<p>SALES</p>
<h4><strong>$2000</strong></h4>
</div>
</div>
<div class="card-body">
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p class="card-text">Better than last week (25%)</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
I'm trying to build a stepping wizard form layout with a bar at the top of the page containing a dynamic number of steps (nodes) and progress bars connecting the nodes. I'm having trouble getting the progress bars and nodes to cooperate.
The idea is to have each nodes spaced evenly on the page horizontally (already working nicely using flexbox), and the progress bars fluidly filling the gaps between the nodes.
I am currently trying to use an <li> to contain each iteration of the progress bar & <a> pairs, but it is not laying out like I need it to (the progress bars are not behaving fluidly and not filling empty space between the <a> tags).
Is this the best way to lay this out?
Just though I'd confirm this is the best way to lay these out before going any further.
EDIT 1 (Clarifying goal):
This image is an example of what I am trying to achieve.
The progress bar and red <a> node are both within the same <li>. I have given the progress bar a width of 90% for this example but the goal is to only assign a width to the red <a> node and have the project bar fluidly fill the remaining space.
Below is the HTML & SCSS I am currently using:
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Project Milestones</div>
</div>
<div class="panel-body">
<ul class="milestone-bar">
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="100.0" aria-valuemin="0" aria-valuemax="100" style="width: 100.0%;">
100%
</div>
</div>
Milestone 1
</li>
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="100.0" aria-valuemin="0" aria-valuemax="100" style="width: 100.0%;">
100%
</div>
</div>
Milestone 3
</li>
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="50.0" aria-valuemin="0" aria-valuemax="100" style="width: 50.0%;">
50%
</div>
</div>
Milestone 2
</li>
</ul>
</div>
</div>
ul.milestone-bar {
padding: 0;
margin: 0 0 15px 0;
display: flex;
li {
width: 100%;
list-style: none;
display: inline-block;;
a {
width: 30px;
height: 30px;
font-size: 12px;
border-radius: 15px;
background-color: red;
float:right;
&:hover {
background: none;
border: 4px solid blue;
}
&:active {
background-color: darkblue;
}
&:focus {
background-color: green;
}
}
.project-progress {
background-color: #d3d3d3;
display: inline-block;
margin: 0;
}
}
}
Is this on the right track?
Below is a snippet of the above:
ul.milestone-bar {
padding: 0;
margin: 0 0 15px 0;
display: flex;
}
ul.milestone-bar li {
width: 100%;
list-style: none;
display: inline-block;
}
ul.milestone-bar li a {
width: 30px;
height: 30px;
font-size: 12px;
border-radius: 15px;
background-color: red;
float: right;
}
ul.milestone-bar li a:hover {
background: none;
border: 4px solid blue;
}
ul.milestone-bar li a:active {
background-color: darkblue;
}
ul.milestone-bar li a:focus {
background-color: green;
}
ul.milestone-bar li .project-progress {
background-color: #d3d3d3;
display: inline-block;
margin: 0;
}
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Project Milestones</div>
</div>
<div class="panel-body">
<ul class="milestone-bar">
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="100.0" aria-valuemin="0" aria-valuemax="100" style="width: 100.0%;">
100%
</div>
</div>
Milestone 1
</li>
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="100.0" aria-valuemin="0" aria-valuemax="100" style="width: 100.0%;">
100%
</div>
</div>
Milestone 3
</li>
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="50.0" aria-valuemin="0" aria-valuemax="100" style="width: 50.0%;">
50%
</div>
</div>
Milestone 2
</li>
</ul>
</div>
</div>
So I did some changes to your code:
Added flex to each li to create nested flex children here:
ul.milestone-bar li {
width: 100%;
list-style: none;
display: flex;
}
Added flex: 1 for it to flex to the whole width and vertically align it to the center using align-self: center to your project-progress like this:
ul.milestone-bar li .project-progress {
background-color: #d3d3d3;
display: inline-block;
margin: 0;
flex: 1;
align-self: center
}
Added the progress bar style:
ul.milestone-bar li .project-progress .progress-bar {
background: #0095FF;
text-align: center;
}
Also adjusted the milestone-bar to look better:
ul.milestone-bar li a {
width: 60px;
height: 60px;
font-size: 10px;
border-radius: 50%;
background-color: red;
text-align: center;
line-height: 60px;
}
ul.milestone-bar li a:hover {
background: none;
border: 4px solid blue;
line-height: 52px;
}
To top it up, used box-sizing: border-box to all elements in the page for better management of border especially to remove the 'jumps' when you hover.
* {
box-sizing: border-box;
}
ul.milestone-bar {
padding: 0;
margin: 0 0 15px 0;
display: flex;
}
ul.milestone-bar li {
width: 100%;
list-style: none;
display: flex;
}
ul.milestone-bar li a {
width: 60px;
height: 60px;
font-size: 10px;
border-radius: 50%;
background-color: red;
text-align: center;
line-height: 60px;
}
ul.milestone-bar li a:hover {
background: none;
border: 4px solid blue;
line-height: 52px;
}
ul.milestone-bar li a:active {
background-color: darkblue;
}
ul.milestone-bar li a:focus {
background-color: green;
}
ul.milestone-bar li .project-progress {
background-color: #d3d3d3;
display: inline-block;
margin: 0;
flex: 1;
align-self: center
}
ul.milestone-bar li .project-progress .progress-bar {
background: #0095FF;
text-align: center;
}
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Project Milestones</div>
</div>
<div class="panel-body">
<ul class="milestone-bar">
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="100.0" aria-valuemin="0" aria-valuemax="100" style="width: 100.0%;">
100%
</div>
</div>
Milestone 1
</li>
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="100.0" aria-valuemin="0" aria-valuemax="100" style="width: 100.0%;">
100%
</div>
</div>
Milestone 3
</li>
<li>
<div class="progress project-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="50.0" aria-valuemin="0" aria-valuemax="100" style="width: 50.0%;">
50%
</div>
</div>
Milestone 2
</li>
</ul>
</div>
</div>
Let me know your feedback on this. Thanks!
I have these text which I added hover to them, But I want the border (border: 2px solid grey) to be limited around the text and not the entire box, how is it possible?
jsFiddle
.eachTitle {
text-align: left;
font-size: 50px;
font-family: "riesling";
color: #80FF00;
}
.eachTitle:hover {
border: 2px solid grey;
cursor: pointer;
}
<div class="eachTitle" id="menu">Our Menu</div>
<div class="eachTitle" id="gallery" style="margin-left: 80px;">Gallery</div>
<div class="eachTitle" id="map" style="margin-left: 160px;">Where are we?</div>
<div class="eachTitle" id="about" style="margin-left: 240px;">About us</div>
.eachTitle {
text-align: left;
font-size: 50px;
font-family: "riesling";
color: #80FF00;
}
.hoverspan:hover {
border: 2px solid grey;
cursor: pointer;
}
<div class="eachTitle" id="menu"><span class="hoverspan">Our Menu</span></div>
<div class="eachTitle" id="gallery" style="margin-left: 80px;"><span class="hoverspan">Gallery</span></div>
<div class="eachTitle" id="map" style="margin-left: 160px;"><span class="hoverspan">Where are we?</span></div>
<div class="eachTitle" id="about" style="margin-left: 240px;"><span class="hoverspan">About us</span></div>
Wrap each element in span and apply border to that element.
.eachTitle {
text-align: left;
font-size: 50px;
font-family: "riesling";
color: #80FF00;
cursor: pointer;
}
.eachTitle span {
border: 2px solid transparent;
}
.eachTitle:hover span {
border-color: grey;
}
<div class="eachTitle" id="menu"><span>Our Menu</span>
</div>
<div class="eachTitle" id="gallery" style="margin-left: 80px;"><span>Gallery</span>
</div>
<div class="eachTitle" id="map" style="margin-left: 160px;"><span>Where are we?</span>
</div>
<div class="eachTitle" id="about" style="margin-left: 240px;"><span>About us</span>
</div>
<div id="menu"><span class="eachTitle">Our Menu</span></div>
See jsfiddle
I have a HTML structure with given CSS.
Both caption and progress elements should be rendered in same line. caption elements should not have fixed width and progress elements should fill up the rest of the space next to caption based on their inline-set width, which means that every progress element will have a different total pixel-width but should fill up only the given percentage of available space.
HTML structure and CSS rules can be changed in any way.
Is it possible to solve this problem with CSS only?
.table {
padding: 15px;
width: 280px;
border: 1px solid black;
font-family: sans-serif;
font-size: 12px;
}
.caption {
float: left;
}
.progress {
height: 14px;
border: 1px solid white;
border-radius: 4px;
background-color: green;
overflow: hidden;
}
.value {
margin-left: 5px;
}
<div class="table">
<div class="row">
<div class="caption">Short text: </div>
<div class="progress" style="width:11.65%">
<span class="value">11.65</span>
</div>
</div>
<div class="row">
<div class="caption">A bit longer text: </div>
<div class="progress" style="width:100%">
<span class="value">100.00</span>
</div>
</div>
<div class="row">
<div class="caption">X: </div>
<div class="progress" style="width:45.50%">
<span class="value">45.50</span>
</div>
</div>
</div>
Have you considered using Flexbox?
Just add this rule:
.row {
display: flex;
}
If your are concerned about browser support, an alternative would be using display:table. You should change your markup and CSS, like this:
.table {
border: 1px solid black;
font-family: sans-serif;
font-size: 12px;
padding: 15px;
width: 280px;
}
.inner-table {
display: table;
}
.row {
display: table-row;
}
.caption {
display: table-cell;
white-space: nowrap;
width: 1%;
}
.progress {
background-color: green;
border: 1px solid white;
border-radius: 4px;
display: table-cell;
height: 14px;
}
.value {
margin-left: 5px;
display:block;
width:0;
overflow: visible;
}
<div class="table">
<div class="inner-table">
<div class="row">
<div class="caption">Short text: </div>
<div style="width:1.65%" class="progress">
<span class="value">1.65</span>
</div>
<div class="remainder"></div>
</div>
</div>
<div class="inner-table">
<div class="row">
<div class="caption">A bit longer text: </div>
<div style="width:100%" class="progress">
<span class="value">100.00</span>
</div>
<div class="remainder"></div>
</div>
</div>
<div class="inner-table">
<div class="row">
<div class="caption">X: </div>
<div class="progress" style="width:45.50%">
<span class="value">45.50</span>
</div>
<div class="remainder"></div>
</div>
</div>
</div>
Please try this - padding-right: 5px; display:inline; add these properties in progress class and also remove width in progress.
Well, just for the future reference, I was playing a bit with the flexbox thingie and came up with this:
.table {
padding: 15px;
width: 280px;
border: 1px solid black;
font-family: sans-serif;
font-size: 12px;
}
.row {
display: flex;
}
.caption {
margin: 1px 5px 1px 0;
}
.progress {
flex-grow: 1;
margin: auto;
}
.progress-content {
height: 14px;
border-radius: 4px;
background-color: green;
}
.value {
margin-left: 5px;
}
<div class="table">
<div class="row">
<div class="caption">Short text:</div>
<div class="progress">
<div class="progress-content" style="width:11.65%">
<span class="value">11.65</span>
</div>
</div>
</div>
<div class="row">
<div class="caption">A bit longer text:</div>
<div class="progress">
<div class="progress-content" style="width:100%">
<span class="value">100.00</span>
</div>
</div>
</div>
<div class="row">
<div class="caption">X:</div>
<div class="progress">
<div class="progress-content" style="width:45.50%">
<span class="value">45.50</span>
</div>
</div>
</div>
</div>
If I get a solution without flexbox, will accept it as an answer :)