I'm using the progressbar control of twitter-bootstrap.
I want to align it vertically to look like in the following image:
I found this thread, but I'm afraid it does not work now.
So I do this: http://tinker.io/e69ff/2
HTML
<br>
<div class="progress vertical">
<div class="bar bar-success" style="width: 70%;"></div>
<div class="bar bar-warning" style="width: 20%;"></div>
<div class="bar bar-danger" style="width: 10%;"></div>
</div>
CSS
.progress.vertical {
position: relative;
width: 20px;
min-height: 240px;
float: left;
margin-right: 20px;
background: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: none;
}
Do you have any tip or advice to get it? If you need more info, let me know and I'll edit the post.
Bootstrap 3 and Bootstrap 4 solution.
Demo: https://jsfiddle.net/elijahmurray/7tgh988z/
I struggled with finding a good solution to this problem for awhile. Ultimately, I ended up writing my own that is semantically similar to how Bootstrap structures their progress bars.
This solution also doesn't use transform, which I found really messed up a lot of things with positioning when using it. Not to mention, it just got confusing with that.
HTML
<div class="progress progress-bar-vertical">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="height: 60%;">
<span class="sr-only">60% Complete</span>
</div>
</div>
CSS
.progress-bar-vertical {
width: 20px;
min-height: 100px;
margin-right: 20px;
float: left;
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6, BB7 */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Safari 6.1+. iOS 7.1+, BB10 */
display: flex; /* NEW, Spec - Firefox, Chrome, Opera */
align-items: flex-end;
-webkit-align-items: flex-end; /* Safari 7.0+ */
}
.progress-bar-vertical .progress-bar {
width: 100%;
height: 0;
-webkit-transition: height 0.6s ease;
-o-transition: height 0.6s ease;
transition: height 0.6s ease;
}
Vote if this was helpful!
Bootstrap 2
Note this is a solution for bootstrap 2:
width 100%, height variable:
<br>
<div class="progress vertical">
<div class="bar bar-success" style="height: 70%;width:100%"></div>
<div class="bar bar-warning" style="height: 20%;width:100%"></div>
<div class="bar bar-danger" style="height: 10%;width:100%"></div>
</div>
Bootstrap 3+
I'd like you to refer to the others comments on this page
this will work:
.progress{
transform: rotate(-90deg);
}
http://codepen.io/mcgraw/pen/eCwvu
Changing the twitter bootstrap progress bar and animation from horizontal position to vertical position
========================================================================
HTML
<div class="progress progress-vertical progress-striped active progress-success">
<div class="bar" style="width: 40px;"></div>
</div>
<div class="progress progress-vertical progress-striped active progress-danger">
<div class="bar" style="width: 40px;"></div>
</div>
CSS
.progress-vertical {
position: relative;
width: 40px;
min-height: 240px;
float: left;
margin-right: 20px; }
Modify The Twitter bootstrap.css file as specified below:
#-webkit-keyframes progress-bar-stripes {
from {
background-position: 0 40px;
}
to {
background-position: 0 0;
}
}
#-moz-keyframes progress-bar-stripes {
from {
background-position: 0 40px;
}
to {
background-position: 0 0;
}
}
#-ms-keyframes progress-bar-stripes {
from {
background-position: 0 40px;
}
to {
background-position: 0 0;
}
}
#-o-keyframes progress-bar-stripes {
from {
background-position: 0 0;
}
to {
background-position: 0 40px;
}
}
#keyframes progress-bar-stripes {
from {
background-position: 0 40px;
}
to {
background-position: 0 0;
}
}
Change background-repeat to repeat-y and the degrees to 0deg. so, that the animation renders vertically
.progress-danger .bar,
.progress .bar-danger {
background-repeat: repeat-y;
}
.progress-danger.progress-striped .bar,
.progress-striped .bar-danger {
background-color: #ee5f5b;
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
Follow the same with the other progress types like success,warning etc and achieve vertical twitter bootstrap progress bars and animations...!
For you have any queries let me know I may help you..!
If any one out there have any optimized solution than this then please let me know..!
Don't forget to support this solution..!
Enjoy!
For the main progress class add the following
.progress{
display: flex;
flex-direction: column-reverse;
}
CSS
.progress{
position: absolute;left:50.5%;top:40%;width: 2.5%;height:50%;opacity: 0.8; filter: alpha(opacity=80);
}
.progress-bar{
position:absolute;top:20%; width: 100%;height: 80%;
}
See complete Code and implementation here
Related
I want a radiant gradient background that is a circular, not ovoid. I want it to scale to the fit the container, which may not be square.
Cover/contain don't treat radial-gradient like a square image, which I suppose makes sense.
Setting background width to 100% operates X and Y independently still.
Setting a fixed px size doesn't allow it to scale to the container.
Are there any pure-CSS ways to make this happen? Maybe a special property value to make the radial gradient act "square" for cover/contain sizing?
.gradier{
height:200px;
width: 300px;
background-image: radial-gradient(rgba(0,255,255, 0.2) 55.5%, rgba(0,255,255,1) 56%, rgba(0,255,255,1) 57%, rgba(0,255,255, 0) 57.5% );
background-size: 100px 100px;
background-size: contain;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
<div class="gradier"></div>
Use circle closest-side
.gradier {
height: 200px;
width: 300px;
border: 1px solid;
background: radial-gradient(circle closest-side, rgba(0, 255, 255, 0.2) 96%, rgba(0, 255, 255, 1) 97% 98%, #0000);
}
<div class="gradier"></div>
Or circle farthest-side
.gradier {
height: 200px;
width: 300px;
border: 1px solid;
background: radial-gradient(circle farthest-side, rgba(0, 255, 255, 0.2) 96%, rgba(0, 255, 255, 1) 97% 98%, #0000);
}
<div class="gradier"></div>
I would like to make some background shapes on my website ...
this is the look that I want
I have tried using the method with rotated/skewed rectangles, it works perfect just when I have only one color on the section below (because I can use the same color for the shapes). If I want to use a texture like in the image attached I will end up having this depending on what method I use. I have also tried using a svg for making the shapes, but I'm not sure if it's the best solution. I'm wondering if there is a clever way to do this. I realize maybe I'm not as clear as a should be, but thank you for finding time to read this.
You'll probably want to experiment with SVGs and masks, depending upon how complicated your shapes are going to be. You can find some great guidance here: https://www.sitepoint.com/masking-in-the-browser-with-css-and-svg/.
Illustrator can be saved as an SVG, but if you're using Sketch it's even easier! You'll notice the code outputs individual coordinates.
You can see a decent demo here: http://cssplant.com/clip-path-generator
This a concept. Try self to work project.
* {
margin: 0;
padding: 0;
}
.wrapper {
width: 100vw;
padding-top: 50%;
position: relative;
background-image: linear-gradient(90deg, rgba(0, 0, 0, .5) 66.6666667%, rgba(255, 255, 0, .6) 66.6666667%), url(http://beerhold.it/1200/600);
background-repeat: no-repeat;
background-size: cover;
overflow: hidden;
}
.wrapper:nth-child(2) {
background-image: linear-gradient(90deg, rgba(255, 255, 255, .7) 0, rgba(255, 255, 255, .7) 100%), url(http://beerhold.it/1400/700);
}
.topleft,
.topright,
.bottomleft,
.bottomright {
position: absolute;
top: 0;
height: 100%;
}
.topleft {
left: 0;
top: 40%;
width: 66.66666667%;
background-image: linear-gradient(transparent 0, transparent 50%, #fff 50%, #fff);
transform: skewY(7deg);
}
.topright {
left: 66.66666667%;
width: 33.33333334%;
top: 42.3%;
background-image: linear-gradient(transparent 0, transparent 50%, #fff 50%, #fff);
transform: skewY(-10deg);
}
.bottomleft {
left: 0;
top: -94%;
width: 33.33333334%;
background-image: linear-gradient(180deg, transparent 0, transparent 50%, #fff 50%, #fff );
transform: skewY(-10deg);
}
.bottomright {
left: 33.33333334%;
width: 66.66666667%;
top: -92%;
background-image: linear-gradient(180deg, transparent 0, transparent 50%, #fff 50%, #fff);
transform: skewY(7deg);
}
<div class="wrapper">
<div class="topleft"></div>
<div class="topright"></div>
</div>
<div class="wrapper">
<div class="topleft"></div>
<div class="topright"></div>
<div class="bottomleft"></div>
<div class="bottomright"></div>
</div>
I made a progress bar which is styled and animated. It is looking good on Opera and Chrome, however I have 2 problems with Firefox and Safari:
The animation effect is not working on Firefox
The progress bar is not appearing at all on Safari
Can anyone help? I write the code below.
Thanks in advance!
Bobby
HTML CODE
<progress value="67" min="0" max="100"></progress>
CSS CODE
progress {
width: 400px;
height: 14px;
/*margin: auto;*/
display: block;
padding: 1px;
appearance:none;
-moz-appearance:none;
-webkit-appearance: none;
border: none;
background-size:auto;
border-radius:15px;
background: -moz-linear-gradient(top, #747467, #515145 49%, #414137 50%, #54544B);
/*background: -ms-linear-gradient(top, #747467, #515145 49%, #414137 50%, #54544B);
background: -o-linear-gradient(top, #747467, #515145 49%, #414137 50%, #54544B);
background: linear-gradient(to bottom, #747467, #515145 49%, #414137 50%, #54544B);*/
/*background-image: none;*/
}
progress::-webkit-progress-bar {
background: -webkit-linear-gradient(top, #747467, #515145 49%, #414137 50%, #54544B);
border-radius: 15px;
padding: 1px;
box-shadow: 0 1px 0px 0 rgba(255, 255, 255, 0.2);
text-align:left;
}
progress::-moz-progress-bar {
background:
-moz-linear-gradient(45deg, transparent, transparent 33%, rgba(0, 0, 0, 0.1) 33%, rgba(0, 0, 0, 0.1) 66%, transparent 66%),
-moz-linear-gradient(top, #70AAE2, #4791DA 49%, #3385D6 50%, #4791DA);
/*-moz-linear-gradient(left, #70AAE2, #4791DA);*/
border-radius: 15px;
box-shadow: 0 1px 0px 0 rgba(255, 255, 255, 0.2);
text-align:left;
background-size: 25px 14px, 100% 100%, 100% 100%;
-moz-animation: move 5s linear 0 infinite;
}
progress::-webkit-progress-value {
border-radius: 15px;
box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.4);
background:
-webkit-linear-gradient(45deg, transparent, transparent 33%, rgba(0, 0, 0, 0.1) 33%, rgba(0, 0, 0, 0.1) 66%, transparent 66%),
-webkit-linear-gradient(top, #70AAE2, #4791DA 49%, #3385D6 50%, #4791DA);
/*-webkit-linear-gradient(left, #70AAE2, #4791DA);*/
background-size: 25px 14px, 100% 100%, 100% 100%;
-webkit-animation: move 5s linear 0 infinite;
}
#-webkit-keyframes move {
0% {background-position: 0px 0px, 0 0, 0 0}
100% {background-position: -100px 0px, 0 0, 0 0}
}
#-moz-keyframes move {
0% {background-position: 0px 0px, 0 0, 0 0}
100% {background-position: -100px 0px, 0 0, 0 0}
}
Its not exactly an answer but more of a suggestion.
Why dont you use bootstrap? It takes care of everything for you:
Normal Progress Bar:
<div class="progress">
<div class="bar" style="width: 60%;"></div>
</div>
Striped:
<div class="progress progress-striped">
<div class="bar" style="width: 20%;"></div>
</div>
and much more.. Check this: http://getbootstrap.com/2.3.2/components.html#progress
To include bootstrap, do:
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
The HTML <progress> Element is used to view the completion progress of a task. While the specifics of how it's displayed is left up to the browser developer, it's typically displayed as a progress bar but looks differently in every browser. JavaScript can be used to manipulate the value of progress bar.
Chrome: works as you expect it to
Firefox: component implementation is like this way.
Safari: check your browser version
for more detailed info:
http://www.w3schools.com/tags/tag_progress.asp
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
I would like my background image to go from 100% opacity to 0% opacity. I could choose to use another image asset where I use an image editor to make the image fade opacity, however I want to use as little assets as possible. Can this be done with CSS? I know I could make several divs in which I change the opacity on each one, however this would require a lot of divs to make it look good.
This is what my code currently looks like with the solution I don't want to use:
<div class="contentFadeAway" id="cfa1"></div>
<div class="contentFadeAway" id="cfa2"></div>
<div class="contentFadeAway" id="cfa3"></div>
<div class="contentFadeAway" id="cfa4"></div>
<div class="contentFadeAway" id="cfa5"></div>
<div class="contentFadeAway" id="cfa6"></div>
<div class="contentFadeAway" id="cfa7"></div>
<div class="contentFadeAway" id="cfa8"></div>
<div class="contentFadeAway" id="cfa9"></div>
<div class="contentFadeAway" id="cfa10"></div>
And the CSS:
.contentFadeAway {
display: block;
position: fixed;
top: 160px;
padding: 0px;
width: 100%;
height: 5px;
background: url('/assets/shapeimage_3_int.png') fixed;
background-size:cover;
z-index: +1;
}
#cfa1 { top: 160px; opacity: 1; }
#cfa2 { top: 165px; opacity: .9; }
#cfa3 { top: 170px; opacity: .8; }
#cfa4 { top: 175px; opacity: .7; }
#cfa5 { top: 180px; opacity: .6; }
#cfa6 { top: 185px; opacity: .5; }
#cfa7 { top: 190px; opacity: .4; }
#cfa8 { top: 195px; opacity: .3; }
#cfa9 { top: 200px; opacity: .2; }
#cfa10 { top: 205px; opacity: .1; }
For those that don't understand what that code is doing it is here: http://jsfiddle.net/FVNY7/2/ I have a background image, and I want the content to fade away when it scrolls up, so I would have the same image with an opacity from 1 to 0 to give that effect. If the background was a solid color I could just use a rgba gradient, but its an image.
For the most cross-browser support, set your background image in your div. Then overlay another div with a semi-transparent gradient background on top of it.
HTML:
<div class="content"></div>
<div class="FadeAway"></div>
CSS:
.content{ position:absolute; top:0px; left:0px; width:100%; height:100%; background:url('http://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/GoldenGateBridge-001.jpg/400px-GoldenGateBridge-001.jpg') no-repeat; }
.FadeAway{
position: absolute; top:0px; left:0px; width:100%; height:100%;
background:transparent;
background: linear-gradient(top, rgba( 255, 255, 255, 255 ) 0%, rgba( 255, 255, 255, 1 ) 100% );
background: -moz-linear-gradient(top, rgba( 255, 255, 255, 0) 0%, rgba( 255, 255, 255, 1 ) 100% );
background: -ms-linear-gradient(top, rgba( 255, 255, 255, 0 ) 0%, rgba( 255, 255, 255, 1 ) 100% );
background: -o-linear-gradient( top, rgba( 255, 255, 255, 0 ) 0%, rgba( 255, 255, 255, 1 ) 100% );
background: -webkit-linear-gradient( top, rgba( 255, 255, 255, 0 ) 0%, rgba( 255, 255, 255, 1 ) 100% );
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#550000FF, endColorstr=#550000FF);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff, endColorstr=#ffffffff);
}
Here's a fiddle of the above example: http://jsfiddle.net/FVNY7/
Although it may not be the best implementation and there could be a better way the best way I have found is the down and dirty implementation that I mentioned in my question. Using PHP code it can be more refined and look good. Here is the code:
<style>
.contentFadeAway {
display: block;
position: fixed;
top: 160px;
padding: 0px;
width: 100%;
height: 1px;
background: url('/assets/shapeimage_3_int.png') fixed;
background-size:cover;
z-index: +1;
}
</style>
<?php
for ($int = "1"; $int <= "50"; $int++) {
echo "<div class=\"contentFadeAway\" style=\"top: " . (160 + 1 * $int) . "px; opacity: " . (1 - .02 * $int) . ";\"></div>\";
";
}
?>
My solution to my problem is to simply state that this is not possible with the current technology. An alternative option would be to use a simple transparency gradient. Until A better solution arrises this is what I will end up doing.
background: linear-gradient(to bottom, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%);
I'm trying to get a background for some text that is dual-tone, or the top half is one color and the bottom half is another. I have attached a link to a picture of what this should look like. Any ideas on how I can achieve this? Thanks, in advance, for the help!
Michael
http://michaelphillips.dropmark.com/12339/296433
Three ways come to mind:
One: Most Cross Browser (CSS1): Make a 1px wide image of the two colors, probably about 30px tall for each color, then
<span class="duoTone">wrap your text in a span</span>
and set the
.duoTone {background-image: url(path/to/your/img.jpg) left center repeat-x;}
Two: Less friendly to older browsers (CSS2): Same span wrapper as above but with this css (see fiddle).
.duoTone {
position: relative;
}
.duoTone:before,
.duoTone:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 50%;
z-index: -1;
background-color: #bbbbbb;
}
.duoTone:after {
top: auto;
bottom: 0;
background-color: #888888;
}
Three: Sleek, but only for newer browsers (CSS3): Same span code as #1 (see fiddle).
.duoTone {
background-color: #888888 ;
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .4)), color-stop(.5, transparent), to(transparent));
background-image: -moz-linear-gradient(rgba(255, 255, 255, .4) 50%, transparent 50%, transparent);
background-image: -o-linear-gradient(rgba(255, 255, 255, .4) 50%, transparent 50%, transparent);
background-image: linear-gradient(rgba(255, 255, 255, .4) 50%, transparent 50%, transparent);
}