CSS: Skirting style - html

Is it possible by using styles to create an DIV like this?
I mean the structure of the plinth. A similar 3D effect

It is kind of possible. You can use background: linear-gradient() for the colors and multiple div's with border-radius for the shape and different heights and widths, e.g.:
.wrapper {
width: 300px;
}
.layer1 {
height: 10px;
width: 300px;
float: right;
border-bottom-left-radius: 8px;
background: #eeeeee;
/* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #eeeeee 0%, #cccccc 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);
/* IE6-9 */
}
.layer2 {
height: 30px;
width: 280px;
float: right;
border-bottom-left-radius: 25px;
background: #b5b5b5;
/* Old browsers */
background: -moz-linear-gradient(top, #b5b5b5 0%, #eeeeee 48%, #cccccc 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(top, #b5b5b5 0%, #eeeeee 48%, #cccccc 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #b5b5b5 0%, #eeeeee 48%, #cccccc 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#b5b5b5', endColorstr='#cccccc', GradientType=0);
/* IE6-9 */
}
.layer3 {
height: 20px;
width: 230px;
float: right;
border-bottom-left-radius: 15px;
background: #eeeeee;
/* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #eeeeee 0%, #cccccc 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);
/* IE6-9 */
}
<div class="wrapper">
<div class="layer1"></div>
<div class="layer2"></div>
<div class="layer3"></div>
</div>
Just play around with the properties a little bit and I'm sure you will get nice results. The above is just a quick ugly example...
Limitations: With this approach it's only possible to build convex curves.

Related

How do I create this image with the specific font and background color with bootstrap and CSS?

I want to recreate this using bootstrap and css, however I'm not too sure on how to approach it. Do I create a jumbotron and resize it to a square? Or do I create a column?
Here is my code below
#rcorners1 {
border-radius: 25px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
<div class="container" >
<p id="rcorners1">JAN</p>
</div>
You really only need a div, like you currently have it.
Check out the snippit. You will have to measure exact font size and font family. This is a good start.
#rcorners1 {
border-radius: 25px;
background: #73AD21;
width: 200px;
height: 150px;
text-align: center;
padding: 38px 0;
box-sizing: border-box;
font-size: 30px;
background: -moz-linear-gradient(top, #77b26d 0%, #ffffff 55%, #ffffff 57%, #77b26d 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(top, #77b26d 0%, #ffffff 55%, #ffffff 57%, #77b26d 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #77b26d 0%, #ffffff 55%, #ffffff 57%, #77b26d 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#77b26d', endColorstr='#77b26d', GradientType=0);
/* IE6-9 */
}
<div class="container">
<p id="rcorners1">JAN<br/>2015</p>
</div>

Inline-flex div gets pushed down when text is more than one line

I'm working on an HTML/CSS chart that displays a series of financial groupings and visually shows how that money is distributed between companies. I've noticed that when the company names are long enough to take up multiple lines, its containing div drops down a bit.
I have the following fiddle: https://jsfiddle.net/s1pxkj7q/1/
Why are those divs getting pushed down and how do I correct it?
Thanks!
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #333333;
background-color: #ffffff;
}
#layers {
width: 1000px;
height: 400px;
margin: 0 auto;
}
#layer-headings {
width: 1000px;
margin: 0 auto;
}
#layer-headings h3 {
width: 50%;
text-align: center;
float: left;
font-size: 14px;
font-weight: bold;
margin-bottom: 50px;
}
#consumed {
width: 50%;
height: 100%;
outline: 1px solid #999;
display: inline-block;
margin: 0;
vertical-align: top;
}
#available {
width: 50%;
height: 100%;
display: inline-block;
margin: 0;
}
#layers h3 {
text-align: center;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 10px 0;
}
#layers .graph {
height: 100%;
width: 100%;
border-bottom: 1px solid #999;
}
#layers h4 {
font-size: 12px;
text-align: center;
}
#layers .graph-box {
margin-left: 5%;
width: 75%;
height: 100%;
float: left;
outline: 1px solid #555;
}
#layers .graph-box h4 {
font-weight: bold;
display: block;
margin: 0 auto;
}
#layers .graph-label {
margin-right: 5%;
padding-left: 10px;
width: 15%;
height: 100%;
vertical-align: top;
display: flex;
align-items: center;
}
#layers .graph-label h3 {
margin: 0;
padding: 0;
}
#layers .graph-col {
height: 100%;
display: inline-flex;
align-items: center;
outline: 1px solid #555;
}
#layers .graph-label.pdf {
display: inline-block;
}
#layers .graph-col.pdf {
display: inline-block;
}
.blue-grad {
background: #3085dd;
/* Old browsers */
background: -moz-linear-gradient(left, #3085dd 0%, #60abf8 50%, #3085dd 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#3085dd), color-stop(0.5, #60abf8), to(#3085dd));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #3085dd 0%, #60abf8 50%, #3085dd 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #3085dd 0%, #60abf8 50%, #3085dd 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#3085dd', endColorstr='#3085dd', GradientType=1);
/* IE6-9 */
}
.red-grad {
background: #e54b29;
/* Old browsers */
background: -moz-linear-gradient(left, #e54b29 0%, #fc8364 50%, #e54b29 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#e54b29), color-stop(0.5, #fc8364), to(#e54b29));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #e54b29 0%, #fc8364 50%, #e54b29 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #e54b29 0%, #fc8364 50%, #e54b29 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#e54b29', endColorstr='#e54b29', GradientType=1);
/* IE6-9 */
}
.yellow-grad {
background: #e2dd31;
/* Old browsers */
background: -moz-linear-gradient(left, #e2dd31 0%, #fffa7a 50%, #e2dd31 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#e2dd31), color-stop(0.5, #fffa7a), to(#e2dd31));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #e2dd31 0%, #fffa7a 50%, #e2dd31 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #e2dd31 0%, #fffa7a 50%, #e2dd31 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#e2dd31', endColorstr='#e2dd31', GradientType=1);
/* IE6-9 */
}
.green-grad {
background: #3bdb30;
/* Old browsers */
background: -moz-linear-gradient(left, #3bdb30 0%, #8cf984 50%, #3bdb30 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#3bdb30), color-stop(0.5, #8cf984), to(#3bdb30));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #3bdb30 0%, #8cf984 50%, #3bdb30 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #3bdb30 0%, #8cf984 50%, #3bdb30 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#3bdb30', endColorstr='#3bdb30', GradientType=1);
/* IE6-9 */
}
.purple-grad {
background: #894bed;
/* Old browsers */
background: -moz-linear-gradient(left, #894bed 0%, #be99ff 50%, #894bed 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#894bed), color-stop(0.5, #be99ff), to(#894bed));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #894bed 0%, #be99ff 50%, #894bed 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #894bed 0%, #be99ff 50%, #894bed 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#894bed', endColorstr='#894bed', GradientType=1);
/* IE6-9 */
}
.orange-grad {
background: #d89531;
/* Old browsers */
background: -moz-linear-gradient(left, #d89531 0%, #fcce99 50%, #d89531 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#d89531), color-stop(0.5, #fcce99), to(#d89531));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #d89531 0%, #fcce99 50%, #d89531 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #d89531 0%, #fcce99 50%, #d89531 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#d89531', endColorstr='#d89531', GradientType=1);
/* IE6-9 */
}
.cyan-grad {
background: #49e5e0;
/* Old browsers */
background: -moz-linear-gradient(left, #49e5e0 0%, #b8f9f5 50%, #49e5e0 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#49e5e0), color-stop(0.5, #b8f9f5), to(#49e5e0));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #49e5e0 0%, #b8f9f5 50%, #49e5e0 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #49e5e0 0%, #b8f9f5 50%, #49e5e0 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#49e5e0', endColorstr='#49e5e0', GradientType=1);
/* IE6-9 */
}
.deepblue-grad {
background: #3b52d3;
/* Old browsers */
background: -moz-linear-gradient(left, #3b52d3 0%, #7692f7 50%, #3b52d3 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#3b52d3), color-stop(0.5, #7692f7), to(#3b52d3));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #3b52d3 0%, #7692f7 50%, #3b52d3 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #3b52d3 0%, #7692f7 50%, #3b52d3 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#3b52d3', endColorstr='#3b52d3', GradientType=1);
/* IE6-9 */
}
.pink-grad {
background: #db3dce;
/* Old browsers */
background: -moz-linear-gradient(left, #db3dce 0%, #fc94f5 50%, #db3dce 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, from(#db3dce), color-stop(0.5, #fc94f5), to(#db3dce));
/* Safari 4-5, Chrome 1-9 */
background: -webkit-linear-gradient(left, #db3dce 0%, #fc94f5 50%, #db3dce 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #db3dce 0%, #fc94f5 50%, #db3dce 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#db3dce', endColorstr='#db3dce', GradientType=1);
/* IE6-9 */
}
#layers #consumed .graph {
padding-right: 5%;
position: relative;
}
#layers #consumed .graph-col {
vertical-align: bottom;
}
#layers #consumed .graph-label {
float: left;
margin-left: 5%;
}
#layers #consumed .graph-row {
position: absolute;
bottom: 0;
width: 100%;
padding-right: 5%;
}
#layers #consumed .graph-box {
margin-left: 0;
}
<div id="layers">
<div id="available">
<div class="graph">
<div class="graph-row" style="height:20%;">
<div class="graph-box red-grad" style="outline:1px solid #555;">
<div class="graph-col" style="width:40%;">
<h4>40%<br>Short</h4>
</div>
<div class="graph-col" style="width:20%;">
<h4>20%<br>This is a long one</h4>
</div>
<div class="graph-col" style="width:30%;">
<h4>30%<br>Short</h4>
</div>
<div class="graph-col" style="width:10%;">
<h4>10%<br>Short</h4>
</div>
</div>
<div class="graph-label">
<h3>$750,000</h3>
</div>
</div>
<div class="graph-row" style="height:27%;">
<div class="graph-box cyan-grad">
<div class="graph-col" style="width:20%;">
<h4>20%<br>Short</h4>
</div>
<div class="graph-col" style="width:40%;">
<h4>40%<br>Short</h4>
</div>
<div class="graph-col" style="width:15%;">
<h4>15%<br>Short</h4>
</div>
<div class="graph-col" style="width:10%;">
<h4>10%<br>Short</h4>
</div>
<div class="graph-col" style="width:15%;">
<h4>15%<br>Short</h4>
</div>
</div>
<div class="graph-label">
<h3>$1,000,000</h3>
</div>
</div>
<div class="graph-row" style="height:27%;">
<div class="graph-box yellow-grad">
<div class="graph-col" style="width:25%;">
<h4>25%<br>Short</h4>
</div>
<div class="graph-col" style="width:22%;">
<h4>22%<br>This is a long one</h4>
</div>
<div class="graph-col" style="width:18%;">
<h4>18%<br>Short</h4>
</div>
<div class="graph-col" style="width: 17%;">
<h4>17%<br>Short</h4>
</div>
<div class="graph-col" style="width:18%;">
<h4>18%<br>Short</h4>
</div>
</div>
<div class="graph-label">
<h3>$1,000,000</h3>
</div>
</div>
<div class="graph-row" style="height:14%;">
<div class="graph-box purple-grad">
<div class="graph-col" style="width:100%;">
<h4>100%<br>Short</h4>
</div>
</div>
<div class="graph-label">
<h3>$500,000</h3>
</div>
</div>
<div class="graph-row" style="height:12%;">
<div class="graph-box orange-grad">
<div class="graph-col" style="width:100%;">
<h4>100%<br>Short</h4>
</div>
</div>
<div class="graph-label">
<h3>$400,000</h3>
</div>
</div>
</div>
</div>
</div>
The problem is baseline alignment due to the vertical-align property.
The vertical-align property applies to inline-level and table-cell elements (source).
Since you're dealing with inline-level containers (display: inline-flex), vertical-align is being applied and its default value is baseline.
Simply override that with vertical-align: top on your containers.
#layers .graph-col {
height: 100%;
display: inline-flex;
align-items: center;
outline: 1px solid #555;
vertical-align: top; /* NEW */
}

Unsure how to position image over gradient correctly

I am generating a gradient on the page. How can I overlay an image in the center of this ribbon? I need to center the image and I cant seem to figure out how to make this work. I am using bootstrap and the page is responsive. So it needs to stay together when the page gets smaller. Any help is appreciated!
Desired Result:
#ribbon-background {
background: #ed1c24; /* Old browsers */
background: -moz-linear-gradient(left, #ed1c24 0%, #600000 50%, #ed1c24 100%); /* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ed1c24), color-stop(50%,#600000), color-stop(100%,#ed1c24)); /* Chrome4-9,Safari4-5 */
background: -webkit-linear-gradient(left, #ed1c24 0%,#600000 50%,#ed1c24 100%); /* Chrome10-25,Safari5.1-6 */
background: -o-linear-gradient(left, #ed1c24 0%,#600000 50%,#ed1c24 100%); /* Opera 11.10-11.50 */
background: -ms-linear-gradient(left, #ed1c24 0%,#600000 50%,#ed1c24 100%); /* IE10 preview */
background: linear-gradient(to right, #ed1c24 0%,#600000 50%,#ed1c24 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ed1c24', endColorstr='#ed1c24',GradientType=1 ); /* IE6-9 */
border-top: 3px solid #000;
border-bottom: 3px solid #000;
box-shadow: 0 7px 0 #FFF inset,
0 -7px 0 #FFF inset;
height: 65px;
margin: 0 auto;
width: 100%;
z-index: 99;
}
<div id="ribbon-background"></div>
One way to do that is to give the ribbon a position: relative; and add the follow style to a child <img>:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
Demo:
#ribbon-background {
background: #ed1c24;
/* Old browsers */
background: -moz-linear-gradient(left, #ed1c24 0%, #600000 50%, #ed1c24 100%);
/* FF3.6-15 */
background: -webkit-gradient(linear, left top, right top, color-stop(0%, #ed1c24), color-stop(50%, #600000), color-stop(100%, #ed1c24));
/* Chrome4-9,Safari4-5 */
background: -webkit-linear-gradient(left, #ed1c24 0%, #600000 50%, #ed1c24 100%);
/* Chrome10-25,Safari5.1-6 */
background: -o-linear-gradient(left, #ed1c24 0%, #600000 50%, #ed1c24 100%);
/* Opera 11.10-11.50 */
background: -ms-linear-gradient(left, #ed1c24 0%, #600000 50%, #ed1c24 100%);
/* IE10 preview */
background: linear-gradient(to right, #ed1c24 0%, #600000 50%, #ed1c24 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ed1c24', endColorstr='#ed1c24', GradientType=1);
/* IE6-9 */
border-top: 3px solid #000;
border-bottom: 3px solid #000;
box-shadow: 0 7px 0 #FFF inset, 0 -7px 0 #FFF inset;
height: 65px;
margin: 0 auto;
width: 100%;
z-index: 99;
position: relative;
}
#ribbon-overlay-img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div id="ribbon-background">
<img id="ribbon-overlay-img" src="http://www.iconsdb.com/icons/preview/orange/stackoverflow-4-xxl.png">
</div>

fade line on top and right of div

Does anybody know how to do this? I need something like this:
I can find somebody doing it with .
hr {
border: 0;
height: 1px;
background: #333;
background: -webkit-gradient(linear, left top, right top, color-stop(0%,hsla(0,0%,0%,0)), color-stop(50%,hsla(0,0%,0%,.75)), color-stop(100%,hsla(0,0%,0%,0)));
background: -webkit-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: -moz-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: -ms-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: -o-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
}
Link: http://jsfiddle.net/HdwKA/662/
But is there anyway I can do if with ::before or ::after?
If I want to add one more fade line on the left? What should I do?
Yes you can, by giving the element an absolute position, you can position the :before & :after pseudo element anywhere in respect to its element.
body {
background-color: black;
}
.hr {
background-color: green;
position: relative;
width: 100px;
height: 100px;
left: 150px;
top: 150px;
}
.hr:before {
content: '';
display: block;
position: absolute;
height: 50px;
width: 1px;
top: -50px;
left: 50%;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&0+0,1+100 */
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
.hr:after {
content: '';
display: block;
position: absolute;
right: -50px;
top: 50%;
height: 1px;
width: 50px;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&1+0,0+100 */
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */
}
<div class="hr">
</div>
UPDATED
Here's an example using span
body {
background-color: black;
}
.hr {
background-color: green;
position: relative;
width: 100px;
height: 100px;
left: 150px;
top: 150px;
}
.top {
display: block;
position: absolute;
height: 50px;
width: 1px;
top: -50px;
left: 50%;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&0+0,1+100 */
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
.bottom {
display: block;
position: absolute;
height: 50px;
width: 1px;
bottom: -50px;
left: 50%;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&1+0,0+100;White+to+Transparent */
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */
}
.right {
display: block;
position: absolute;
right: -50px;
top: 50%;
height: 1px;
width: 50px;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&1+0,0+100 */
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */
}
.left {
display: block;
position: absolute;
left: -50px;
top: 50%;
height: 1px;
width: 50px;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+100&0+0,1+100 */
background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */
}
<div class="hr">
<span class="left"></span>
<span class="right"></span>
<span class="top"></span>
<span class="bottom"></span>
</div>
that works with a pseudo selector.
I added you a solution to a fiddle based on a DIV element (but could be any other valid CSS selector):
http://codepen.io/marcbaur/pen/ZOxaxE/
div::after {
display: block;
width: 100%;
content: '';
border: 0;
height: 1px;
background: #333;
background: -webkit-gradient(linear, left top, right top, color-stop(0%,hsla(0,0%,0%,0)), color-stop(50%,hsla(0,0%,0%,.75)), color-stop(100%,hsla(0,0%,0%,0)));
background: -webkit-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: -moz-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: -ms-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: -o-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
background: linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%);
you just have to make sure that you define content, display and width properties.

Using Custom scrollbars to contain text?

I have edited some cool scrollbars. I needed text to be in the middle, so it is like a frame...like you see when you accept someones terms of service and stuff. I have tried to add text, but i can not seem to get it to work? http://jsfiddle.net/Hunter4854/RHMCm/ Please do not down vote if you have a question, just add a comment, and i will answer :)
<head>
<meta content="en-us" http-equiv="Content-Language">
<style>body {
top: 0;
left: 0;
bottom: 0;
right: 0;
background: green;
}
.a::-webkit-scrollbar {
width: 15px;
height: 15px;
}
.a::-webkit-scrollbar:vertical {
background: -webkit-linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}
.a::-webkit-scrollbar:horizontal {
background: -webkit-linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}
.a::-webkit-scrollbar-track:vertical {
background: -webkit-linear-gradient(left, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(left, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* W3C */
border-radius: 15px;
}
.a::-webkit-scrollbar-track:horizontal {
background: -webkit-linear-gradient(top, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(top, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* W3C */
border-radius: 15px;
}
.a::-webkit-scrollbar-thumb {
border-radius: 15px;
border: 1px solid black;
}
.a::-webkit-scrollbar-thumb:vertical {
background: -webkit-linear-gradient(left, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(left, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* W3C */
}
.a::-webkit-scrollbar-thumb:horizontal {
background: -webkit-linear-gradient(top, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(top, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* W3C */
}
.a::-webkit-scrollbar-thumb:hover {
}
.a::-webkit-scrollbar-corner {
background: black;
}
.a::-webkit-scrollbar-button:vertical {
background: -webkit-linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}
.a::-webkit-scrollbar-button:horizontal {
background: -webkit-linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}
​</style>
</head>
<div class="a" style="position:absolute;width:200px;height:200px;background:white;overflow-y:scroll">
</div>
See it here http://jsfiddle.net/3uTjv/