Center align div content if font size change - html

My Code is like below.
.wpwi_main {
border: 1px solid aliceblue;
border-radius: 5px;
font-size: 9px;
}
.wpwi_top {
text-align: center;
}
.wpwi_outer {
text-align: center;
margin: auto;
padding-bottom: 20px;
width: 100%;
}
.wpwi_inner {
display: table;
width: 40%;
margin: auto;
}
.wpwi_row {
display: table-row;
width: 50%;
}
.wpwi_row > div {
display: table-cell;
width: 20%;
}
<div class="wpwi_main">
<div class="wpwi_top">Top</div>
<div class="wpwi_outer">
<div>Outer</div>
</div>
<div class="wpwi_inner">
<div class="wpwi_row">
<div>Time</div>
<div>8:02 PM</div>
</div>
<div class="wpwi_row">
<div>Date</div>
<div>13 Aug 2022</div>
</div>
<div class="wpwi_row">
<div>Pressure</div>
<div>999 hPa</div>
</div>
<div class="wpwi_row">
<div>Visibility</div>
<div>10000 Meter</div>
</div>
<div class="wpwi_row">
<div>Cloudiness</div>
<div>98%</div>
</div>
<div class="wpwi_row">
<div>Sunrise</div>
<div>5:37 AM</div>
</div>
<div class="wpwi_row">
<div>Sunset</div>
<div>6:39 PM</div>
</div>
</div>
</div>
I would like to keep two columns as close as possible without line break and center aligned when font size increase or decrease. I would like to keep like this image when font size is 28px https://i.stack.imgur.com/lYOzI.png and I would like to keep like this image when font size is 9px https://i.stack.imgur.com/89Jc3.png

You can try to unset width: 40% on .wpwi_inner and increase the width of .wpwi_row > div from 20% to 60%.
.wpwi_main {
border: 1px solid aliceblue;
border-radius: 5px;
font-size: 9px;
}
.wpwi_top {
text-align: center;
}
.wpwi_outer {
text-align: center;
margin: auto;
padding-bottom: 20px;
width: 100%;
}
.wpwi_inner {
display: table;
/* width: 40%; */ /* Removed this */
margin: auto;
}
.wpwi_row {
display: table-row;
width: 50%;
}
.wpwi_row > div {
display: table-cell;
width: 60%; /*Increase this width to 60%*/
}
<div class="wpwi_main">
<div class="wpwi_top">Top</div>
<div class="wpwi_outer">
<div>Outer</div>
</div>
<div class="wpwi_inner">
<div class="wpwi_row">
<div>Time</div>
<div>8:02 PM</div>
</div>
<div class="wpwi_row">
<div>Date</div>
<div>13 Aug 2022</div>
</div>
<div class="wpwi_row">
<div>Pressure</div>
<div>999 hPa</div>
</div>
<div class="wpwi_row">
<div>Visibility</div>
<div>10000 Meter</div>
</div>
<div class="wpwi_row">
<div>Cloudiness</div>
<div>98%</div>
</div>
<div class="wpwi_row">
<div>Sunrise</div>
<div>5:37 AM</div>
</div>
<div class="wpwi_row">
<div>Sunset</div>
<div>6:39 PM</div>
</div>
</div>
</div>

Related

Center align div content responsively

I need to center align div content responsively.
.wpwi_main {
border: 1px solid aliceblue;
border-radius: 5px;
font-size: 9px;
}
.wpwi_top {
text-align: center;
}
.wpwi_outer {
text-align: center;
margin: auto;
padding-bottom: 20px;
width: 100%;
}
.wpwi_inner {
display: table;
width: 40%;
margin: auto;
}
.wpwi_row {
display: table-row;
width: 50%;
}
.wpwi_row > div {
display: table-cell;
width: 20%;
}
<div class="wpwi_main">
<div class="wpwi_top">Top</div>
<div class="wpwi_outer">
<div>Outer</div>
</div>
<div class="wpwi_inner">
<div class="wpwi_row">
<div>Time</div>
<div>8:02 PM</div>
</div>
<div class="wpwi_row">
<div>Date</div>
<div>13 Aug 2022</div>
</div>
<div class="wpwi_row">
<div>Pressure</div>
<div>999 hPa</div>
</div>
<div class="wpwi_row">
<div>Visibility</div>
<div>10000 Meter</div>
</div>
<div class="wpwi_row">
<div>Cloudiness</div>
<div>98%</div>
</div>
<div class="wpwi_row">
<div>Sunrise</div>
<div>5:37 AM</div>
</div>
<div class="wpwi_row">
<div>Sunset</div>
<div>6:39 PM</div>
</div>
</div>
</div>
How can I center align content of wpwi_inner div so that content will remain center aligned if font size increase or decrease ?
You probably want to look at flexbox. You can tell flexbox children to be centered on either axis with very little effort and browser support is very strong these days.
.flex{
display: flex;
justify-content: center;
}
.wpwi_main {
border: 1px solid aliceblue;
border-radius: 5px;
font-size: 20px;
}
.wpwi_top {
text-align: center;
}
.wpwi_outer {
text-align: center;
margin: auto;
padding-bottom: 20px;
width: 100%;
}
.wpwi_inner {
display: table;
width: 40%;
margin: auto;
}
.wpwi_row {
display: table-row;
width: 50%;
}
.wpwi_row > div {
display: table-cell;
width: 20%;
}
<div class="flex-container">
<div class="wpwi_main">
<div class="wpwi_top">Top</div>
<div class="wpwi_outer">
<div>Outer</div>
</div>
<div class="flex">
<div class="wpwi_inner">
<div class="wpwi_row">
<div>Time</div>
<div>8:02 PM</div>
</div>
<div class="wpwi_row">
<div>Date</div>
<div>13 Aug 2022</div>
</div>
<div class="wpwi_row">
<div>Pressure</div>
<div>999 hPa</div>
</div>
<div class="wpwi_row">
<div>Visibility</div>
<div>10000 Meter</div>
</div>
<div class="wpwi_row">
<div>Cloudiness</div>
<div>98%</div>
</div>
<div class="wpwi_row">
<div>Sunrise</div>
<div>5:37 AM</div>
</div>
<div class="wpwi_row">
<div>Sunset</div>
<div>6:39 PM</div>
</div>
</div>
</div>
</div>
</div>
In the snippet, I enclosed your wpwi_inner within a div that has display: flex. Using the justify-content property we can make children of the flexbox stay centered on the main axis regardless of the size of the content inside.

how to put the text below the images without {css}

Whenever I'm trying to change .tea to display: block; all the images change their position from being horizontal, to being vertical
How to position it the correct way so the images keep being horizontally aligned and the text will be underneath
.tea {
display: inline-flex;
margin-left: 225px;
padding: 20px;
justify-content: center;
}
.tea h4 {
display: inline-block;
position: relative;
text-align: center;
}
.tea2 {
display: inline-flex;
margin-left: 385px;
}
.tea img {
width: 300px;
height: 200px;
padding: 25px;
border-radius: 15px;
}
.tea2 img {
width: 300px;
height: 200px;
padding: 30px;
}
<div class="tea">
<img class="1" src="https://via.placeholder.com/150">
<h4>Myrtle Ave</h4>
<img class="2" src="https://via.placeholder.com/150">
<h4>Spiced rum</h4>
<img class="3" src="https://via.placeholder.com/150">
<h4>Berry Blitz</h4>
</div>
<div class="tea2">
<img class="1" src="https://via.placeholder.com/150">
<img class="2" src="https://via.placeholder.com/150">
</div>
You should do it like this
* {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
}
#gallery {
display: flex;
flex-wrap: wrap;
}
#gallery .image-container {
width: 25%;
background-color: lightgreen;
border-radius: 5px;
padding: 5px;
box-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
}
#gallery img {
width: 100%;
}
#gallery .title {
font: bold 24px monospace;
text-align: center;
color: white;
margin: 2%;
}
<div id="gallery">
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 1</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 2</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 3</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 4</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 5</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 6</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 7</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 8</p>
</div>
</div>
You need to change you HTML to support what you want. Use a container wrapper around the image and image text.
Example: https://jsfiddle.net/Lqupmf5s/
<div class="tea">
<div class="img-container">
<img class="1" src="32131">
<h4>Myrtle Ave</h4>
</div>
<div class="img-container">
<img class="2" src="3213">
<h4>Spiced rum</h4>
</div>
<div class="img-container">
<img class="3" src="3213">
<h4>Berry Blitz</h4>
</div>
</div>
.tea {
display: inline-flex;
/* margin-left: 225px; */
padding: 20px;
justify-content: center; }
.tea h4{
display: inline-block;
position: relative;
text-align: center; }
.tea2 {
display: inline-flex;
margin-left: 385px; }
.tea img {
width: 300px;
height: 200px;
/* padding: 25px; */
border-radius: 15px; }
.tea2 img {
width: 300px;
height: 200px;
padding: 30px; }

responsive progress circle using uikit and css

.booking{
background-color: #f8f8f8;
}
.circle-text {
display: block;
margin: auto;
height: 150px;
width: 150px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background:green ;
color: #fff;
font: 12px "josefin sans", arial;
line-height: 150px;
z-index: 1;
position: relative;
}
#media screen and (min-width: 320px) and (max-width:800px) {
.circle-text{
height:70px;
width:70px;
line-height:70px;
}
}
#media screen and (min-width:320px) and (max-width:800px){
.steps:not(:first-child)::before {
content: "";
top: 37px;
}
}
.step:nth-child(2) .circle-text {
background: grey;
}
.step:nth-child(3) .circle-text {
background: grey;
}
.a {
display: inline-block;
position: relative;
}
.uk-process-step {
position: relative;
}
.step:not(:first-child)::before {
content: "";
left: -50%;
position: absolute;
top: 77px;
width: 100%;
border-bottom: 5px solid grey;
}
.step.active ~ .step:before {
border-bottom: 5px dotted grey;
}
.uk-process-step .uk-width-1-3 {
position: relative;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<section class=" booking">
<div class="uk-container uk-container-expand uk-padding-large">
<div class="uk-text-center uk-process-step" uk-grid>
<div class="uk-width-1-3 step circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 step active">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3 step ">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</section>
enter code here
I want to make responsive progress bar using pure css and uikit 3. This code i was written it works when it show in desktop mode . when i switching desktop mode to mobile mode , line is not responsive .the line goes to down . But i want to these line middle of circle even in desktop mode as well and mobile mode.
Use media queries and define the breakpoints
Try this.
.booking{
background-color: #f8f8f8;
}
.circle-text {
display: block;
margin: auto;
height: 150px;
width: 150px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background:green ;
color: #fff;
font: 12px "josefin sans", arial;
line-height: 150px;
z-index: 1;
position: relative;
}
.step:nth-child(2) .circle-text {
background: grey;
}
.step:nth-child(3) .circle-text {
background: grey;
}
.a {
display: inline-block;
position: relative;
}
.uk-process-step {
position: relative;
}
.step:not(:first-child)::before {
content: "";
left: -50%;
position: absolute;
top: 77px;
width: 100%;
border-bottom: 5px solid grey;
}
.step.active ~ .step:before {
border-bottom: 5px dotted grey;
}
.uk-process-step .uk-width-1-3 {
position: relative;
}
#media screen and (max-width:767px)
{
.circle-text{
width:120px;
height:120px;
line-height: 120px;
}
.step:not(:first-child)::before{
top:60px;
}
}
#media screen and (max-width:480px)
{
.circle-text{
width:100px;
height:100px;
line-height: 100px;
}
.step:not(:first-child)::before{
top:50px;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<section class=" booking">
<div class="uk-container uk-container-expand uk-padding-large">
<div class="uk-text-center uk-process-step" uk-grid>
<div class="uk-width-1-3 step circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 step active">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3 step ">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</section>

responsive progress circle step bar

.circle{
padding:20px !important;
}
h2{
margin:unset;
}
.circle-text {
display: block;
margin: auto;
height: 120px;
width: 120px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background: #FF9800 ;
color: #fff;
font: 18px "josefin sans", arial;
line-height: 120px;
}
.a {
display: inline-block;
position: relative;
}
.a:before,
.a:after {
content: "";
position: absolute;
height: 60px;
border-bottom: 5px solid black;
top:0;
width: 293px;
}
.a:before {
right: 100%;
margin-right: 0px;
}
.a:after {
left: 100%;
margin-left:0px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<div class="uk-section-align uk-margin-xlarge-top">
<div class="uk-container">
<div class="uk-text-center" uk-grid>
<div class="uk-width-1-3 circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 ">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</div>
I want to make responsive progress bar using pure css and uikit 3. This code i was written it works when it show in desktop mode . when i switching desktop mode to mobile mode , middle black line strike both circle. i just want to when it show in mobile mode also it only touch the circle.
please give some suggestion.
Try this
.circle{
padding:20px !important;
}
h2{
margin:unset;
}
.circle-text {
display: block;
margin: auto;
height: 120px;
width: 120px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background: #FF9800 ;
color: #fff;
font: 18px "josefin sans", arial;
line-height: 120px;
}
.a {
display: inline-block;
position: relative;
}
/*
.a:before,
.a:after {
content: "";
position: absolute;
height: 60px;
border-bottom: 5px solid black;
top:0;
width: 293px;
}
.a:before {
right: 100%;
margin-right: 0px;
}
.a:after {
left: 100%;
margin-left:0px;
}
*/
.uk-process-step {
position: relative;
}
.uk-process-step:before {
top: 60px;
bottom: 0;
position: absolute;
content: " ";
width: 100%;
height: 5px;
background-color: black;
}
.uk-process-step .uk-width-1-3 {
position: relative;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<div class="uk-section-align uk-margin-xlarge-top">
<div class="uk-container">
<div class="uk-text-center uk-process-step" uk-grid>
<div class="uk-width-1-3 circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 ">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</div>
Use z-index for the pseudo elements (the black line).
Set it to -1 so that it will go beyond the circle.
Try this
.circle{
padding:20px !important;
}
h2{
margin:unset;
}
.circle-text {
display: block;
margin: auto;
height: 120px;
width: 120px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background: #FF9800 ;
color: #fff;
font: 18px "josefin sans", arial;
line-height: 120px;
}
.a {
display: inline-block;
position: relative;
}
.a:before,
.a:after {
content: "";
position: absolute;
height: 60px;
border-bottom: 5px solid black;
top:0;
width: 293px;
}
.a:before {
right: 100%;
margin-right: 0px;
z-index: -1;
}
.a:after {
left: 100%;
margin-left:0px;
z-index:-1
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<div class="uk-section-align uk-margin-xlarge-top">
<div class="uk-container">
<div class="uk-text-center" uk-grid>
<div class="uk-width-1-3 circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 ">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</div>

Add labels to a horizontal bar chart

I am new to HTML. In the following chart, how can I add some labels such as
Team 1up
Team blue
Team tigers
Team watermelon
Team crazyred
Team Melt
At the left side of the chart tracks all right aligned?
$(function() {
$('.progress-fill span').each(function(){
var percent = $(this).html();
$(this).parent().css('width', percent);
});
});
body {
background: #999;
}
.container {
width: 500px;
margin: 20px;
background: #fff;
padding: 20px;
overflow: hidden;
float: left;
}
.horizontal .progress-bar {
float: left;
height: 18px;
width: 100%;
padding: 3px 0;
}
.horizontal .progress-track {
position: relative;
width: 100%;
height: 20px;
background: #ebebeb;
}
.horizontal .progress-fill {
position: relative;
background: #666;
height: 20px;
width: 50%;
color: #fff;
text-align: center;
font-family: "Lato","Verdana",sans-serif;
font-size: 12px;
line-height: 20px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container horizontal flat">
<h2>Team performances</h2>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>100%</span>
</div>
</div>
</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>75%</span>
</div>
</div>
</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>60%</span>
</div>
</div>
</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>20%</span>
</div>
</div>
</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>34%</span>
</div>
</div>
</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>82%</span>
</div>
</div>
</div>
</div>
You can create a component called progress-group and put progress-label and progress-bar in it. progress-group takes care of responsibility for children alignment. I used flex which makes sense in this case. This gives you much more control if you want to add extra components in future.
https://codepen.io/anon/pen/oPVyYm
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container horizontal flat">
<h2>Team performances</h2>
<div class="progress-group">
<div class="progress-label">Team 1up</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>100%</span>
</div>
</div>
</div>
</div>
<div class="progress-group">
<div class="progress-label">Team blue</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>75%</span>
</div>
</div>
</div>
</div>
<div class="progress-group">
<div class="progress-label">Team tigers</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>60%</span>
</div>
</div>
</div>
</div>
<div class="progress-group">
<div class="progress-label">Team watermelon</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>20%</span>
</div>
</div>
</div>
</div>
<div class="progress-group">
<div class="progress-label">Team crazyred</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>34%</span>
</div>
</div>
</div>
</div>
<div class="progress-group">
<div class="progress-label">Team Melt</div>
<div class="progress-bar horizontal">
<div class="progress-track">
<div class="progress-fill">
<span>82%</span>
</div>
</div>
</div>
</div>
</div>
body {
background: #999;
}
.container {
width: 500px;
margin: 20px;
background: #fff;
padding: 20px;
overflow: hidden;
float: left;
}
.horizontal .progress-bar {
float: left;
height: 18px;
width: 100%;
padding: 3px 0;
}
.horizontal .progress-track {
position: relative;
width: 100%;
height: 20px;
background: #ebebeb;
}
.horizontal .progress-fill {
position: relative;
background: #666;
height: 20px;
width: 50%;
color: #fff;
text-align: center;
font-family: "Lato","Verdana",sans-serif;
font-size: 12px;
line-height: 20px;
}
.progress-group {
display: flex;
}
.progress-label {
width: 170px;
text-align: right;
padding-right: 10px;
}
.progress-label::after {
content: ":";
}
$(function() {
$('.progress-fill span').each(function(){
var percent = $(this).html();
$(this).parent().css('width', percent);
});
});
Something like this sir?
https://codepen.io/JABedford/pen/RYdMjV
I have simply floated the bars over to the right and decreased the width to 80% and created another span for the relevant text.
<div class="progress-bar horizontal">
<span class="name">Team Name</span>
<div class="progress-track">
<div class="progress-fill">
<span>75%</span>
</div>
</div>
body {
background: #999;
}
.container {
width: 500px;
margin: 20px;
background: #fff;
padding: 20px;
overflow: hidden;
float: left;
}
.horizontal .progress-bar {
float: right;
height: 18px;
width: 100%;
padding: 3px 0;
}
.horizontal .progress-track {
position: relative;
float: left;
width: 80%;
height: 20px;
background: #ebebeb;
}
.horizontal .progress-fill {
position: relative;
background: #666;
height: 20px;
width: 50%;
color: #fff;
text-align: center;
font-family: "Lato","Verdana",sans-serif;
font-size: 12px;
line-height: 20px;
}