Unusual tapered div design [closed] - css

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How can I achieve a design like this with CSS3. I tried to give it a very high transparent border but that makes the taper outwards and not inwards.
It looks like something that can be achieved with CSS that is why I am reluctant to use images for this.

I would suggest using :before and :after to 'cover' parts of your gradient'ed div.
The problem is that borders dont support '%' as standard. So you'll have to use #media queries if your div needs to be responsive to change out the width of the borders, like below.
JSFiddle
HTML
<div id="angled"></div>
CSS
body{
margin:0;
padding:0;
}
#angled{
background: #6393c1;
background: -moz-linear-gradient(top, #6393c1 0%, #cfe7fa 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6393c1), color-stop(100%,#cfe7fa));
background: -webkit-linear-gradient(top, #6393c1 0%,#cfe7fa 100%);
background: -o-linear-gradient(top, #6393c1 0%,#cfe7fa 100%);
background: -ms-linear-gradient(top, #6393c1 0%,#cfe7fa 100%);
background: linear-gradient(to bottom, #6393c1 0%,#cfe7fa 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6393c1', endColorstr='#cfe7fa',GradientType=0 );
width:500px;
margin:0 auto;
height:200px;
position:relative;
}
#angled:before,
#angled:after{
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
content:" ";
height:0;
left:0;
right:0;
position:absolute;
bottom:0;
}
#angled:after{
border:30px solid rgba(255, 255, 255, 0);
border-bottom-width:0;
border-left-width:200px;
border-left-color:white;
}
#angled:before{
border:60px solid rgba(255, 255, 255, 0);
border-bottom-width:0;
border-right-width:300px;
border-right-color:white;
}
#media (min-width:800px){
#angled{
width:800px;
}
#angled:after{
border-left-width:350px;
}
#angled:before{
border-right-width:450px;
}
}
#media (min-width:1200px){
#angled{
width:1200px;
}
#angled:after{
border-left-width:500px;
}
#angled:before{
border-right-width:700px;
}
}
gradient generated using Ultimate CSS Gradient Generator

The below should give you a starting point, the key is creating triangles using the borders of a divs :before and :after pseudo elements.
Demo Fiddle
HTML
<div></div>
CSS
html, body, div {
width:100%;
margin:0;
padding:0;
}
div {
height:100px;
width:600px;
background:#007bff;
}
div:before, div:after {
content:'';
position:absolute;
display:block;
}
div:before {
width: 0px;
height: 0px;
top:100px;
border-style: solid;
border-width: 0px 200px 50px 0;
border-color: transparent #007bff transparent transparent;
}
div:after {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 0 50px 400px;
border-color: transparent transparent transparent #007bff;
top:100px;
left:200px;
}

looks good so no?
I leave an example
http://jsfiddle.net/jdQaA/1/
header{
display:inline-block;
background: white;
text-align: center;
width: 100%;
}
.main{
display:inline-block;
width: 1024px;
margin:0 auto;
min-height: 100px;
background: #1e5799; /* Old browsers */
background: -moz-linear-gradient(top, #1e5799 0%, #7db9e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1e5799 0%,#7db9e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #1e5799 0%,#7db9e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */
position:relative;
}
.main:before{
content: '';
position: absolute;
top: 100%;
left: 100px;
height: 1px;
width: 100%;
border-left: 924px solid #7db9e8;
border-bottom: 50px solid transparent;
}
.main:after{
content: '';
position: absolute;
top: 100%;
left: 0px;
height: 1px;
width: auto;
border-left: 100px solid #7db9e8;
border-bottom: 50px solid transparent;
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.container{
width: 1024px;
display:inline-block;
}
.submain{
float:right;
position: relative;
top: 60px;
width: 300px;
height: 300px;
background: #7db9e8; /* Old browsers */
background: -moz-linear-gradient(top, #7db9e8 0%, #1e5799 97%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7db9e8), color-stop(97%,#1e5799)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #7db9e8 0%,#1e5799 97%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #7db9e8 0%,#1e5799 97%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #7db9e8 0%,#1e5799 97%); /* IE10+ */
background: linear-gradient(to bottom, #7db9e8 0%,#1e5799 97%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7db9e8', endColorstr='#1e5799',GradientType=0 ); /* IE6-9 */
margin-top: -25px;
}
.submain:before{
content: '';
position: absolute;
bottom: 100%;
left: 0px;
height: 1px;
width: auto;
border-right: 300px solid #7CB7E7;
border-top: 25px solid transparent;
}

Related

Can't combine CSS Sprite and Background Gradient in Chrome/Safari

This used to work fine, however recently the gradient doesn't work properly in Webkit. Seems to be fine in Firefox. Can someone check if I'm setting something incorrectly. Don't pay attention to the images. Its the gradient I can't get to render. Any ideas please?
JSFIDDLE: http://jsfiddle.net/UdxUg/2/
-webkit-gradient
It's due to the old syntax, generally webkit/blink now allows using a vendor-less value.
Generally you should use a :pseudo-element --> http://jsfiddle.net/UdxUg/6/
anyways here's a code that works.
works with image
.create {
border: 1px solid #63ac5c;
background: #d9ead8 url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px;
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dbe8d9), color-stop(100%, #bcd7b9));
/* Safari 4+, Chrome 2+ */
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, -moz-linear-gradient(top, #dbe8d9, #bcd7b9);
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, -webkit-linear-gradient(top, #dbe8d9, #bcd7b9);
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, linear-gradient(top, #dbe8d9, #bcd7b9);
height: 23px;
text-align:center;
}
use this instead though
.create {
border: 1px solid #63ac5c;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dbe8d9), color-stop(100%, #bcd7b9)); /* Safari 4+, Chrome 2+ */
background: -webkit-linear-gradient(top, #dbe8d9, #bcd7b9);
background: -moz-linear-gradient(top, #dbe8d9, #bcd7b9);
background: linear-gradient(top, #dbe8d9, #bcd7b9);
height: 23px;
text-align:center;
position: relative
}
.create:before {
content: '';
background: #d9ead8 url('http://tinyurl.com/mezxsk6') no-repeat 0 0;
height: 23px;
width: 23px;
position: absolute;
top: 0;
left: 0;
}
Check this I always use this generator to generate gradients, it is faster and it is good.
CSS3 Ultimate Gradient Generator
BTW if you remove that images the gradient works just fine in webkit.
Check on jsFiddle
.create {
border: 1px solid #63ac5c;
background: rgb(188,215,185); /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIyNCUiIHN0b3AtY29sb3I9IiNiY2Q3YjkiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSI5OSUiIHN0b3AtY29sb3I9IiNkYmU4ZDkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, rgba(188,215,185,1) 24%, rgba(219,232,217,1) 99%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(24%,rgba(188,215,185,1)), color-stop(99%,rgba(219,232,217,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* IE10+ */
background: linear-gradient(to bottom, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bcd7b9', endColorstr='#dbe8d9',GradientType=0 ); /* IE6-8 */
height: 23px;
text-align:center;
}

intermittent border + border radius

Is it real to make such border through css?
I thought about
border: 3px solid white;
border-top: none;
and pseudo-element with gradient, but its not exactly the same.
You can do this by adding a pseudo-element with a gradient. transparent -> white -> transparent.
FIDDLE
CSS
div
{
width: 600px;
height: 200px;
border: 5px solid black;
border-radius: 20px;
position: relative;
margin: 50px;
}
div:before
{
content: '';
position: absolute;
top:-5px;
left:0;right:0;
margin:auto;
height: 5px;
width: 80%;
background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 1%, rgba(255,255,255,1) 17%, rgba(255,255,255,1) 85%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,0)), color-stop(1%,rgba(255,255,255,0)), color-stop(17%,rgba(255,255,255,1)), color-stop(85%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,0) 1%,rgba(255,255,255,1) 17%,rgba(255,255,255,1) 85%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,0) 1%,rgba(255,255,255,1) 17%,rgba(255,255,255,1) 85%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,0) 1%,rgba(255,255,255,1) 17%,rgba(255,255,255,1) 85%,rgba(255,255,255,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(255,255,255,0) 0%,rgba(255,255,255,0) 1%,rgba(255,255,255,1) 17%,rgba(255,255,255,1) 85%,rgba(255,255,255,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */
}
[Update: this can be done with a radial gradient, but Im no longer in front of my computer.]
I'm not sure that there's a border gradient (yet anyway), but I built something with nested s for you. Just an idea. It's just missing the solid white across the bottom. Hope it's helpful.
jsfiddle: http://jsfiddle.net/itsmikem/HfCT3/
css:
div {
position:relative;
}
#outer {
background: #cccc00;
width:200px;
padding:10px;
}
#mid {
border-radius:10px;
background: #ffffff;
background: -webkit-linear-gradient(left, #ffffff 0%,#cccc00 50%,#ffffff 100%);
background: linear-gradient(to right, #ffffff 0%,#cccc00 50%,#ffffff 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=1 );
padding:3px;
}
#inner {
/*width:100%;
height:100%;*/
background:#cccc00;
border-radius:10px;
padding:10px;
}
html:
<div id="outer">
<div id="mid">
<div id="inner">stuff
</div>
</div>
</div>

Converting absolute positioning to relative

I was stupid and built a web widget in jsFiddle using absolute positioning because it was just a quick prototype to show someone how the functionality would work.
Well we decided that we're gonna use it now and I'm having a hell of a time converting the elements to utilize relative positioning. Also, I'm in the middle of trying to convert this to a jQuery UI widget, so I want everything set up so that it just dumps onto the page without issue.
The widget can be seen HERE. Basically it's a search box of sorts that will allow some filtering with the left-most button.
The components are as such:
#refine: The left-most button.
#refineDropdown: The drop down menu that appears when you click on the refine button
#search: The input box
#dropdown: The live-type search filtering box
#submit: The right-most search button
Question: When creating a widget, should positioning be done relatively or absolutely? If I have multiple instances of this on a page, the position of the dropdowns should be independent of their position on the page, but I don't fully understand positioning and HTML arrangement to get this to work.
CSS:
.inline { float:left; }
.clearBoth { clear:both; }
#refine {
position: relative;
margin-right: -3px;
overflow:hidden;
white-space:nowrap;
background: rgb(238,238,238); /* Old browsers */
background: -moz-linear-gradient(top, rgba(238,238,238,1) 0%, rgba(204,204,204,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(204,204,204,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
border-top-left-radius:4px;
border-bottom-left-radius:4px;
border:1px solid #AAA;
height:12px;
padding:6px 25px 6px 6px;
text-align:center;
font-size:11px;
font-family:Helvetica, sans-serif;
color:#666;
text-shadow:0px 1px 0px #e8eae5;
}
#refine:hover {
background: rgb(238,238,238); /* Old browsers */
background: -moz-linear-gradient(top, rgba(238,238,238,1) 0%, rgba(221,221,221,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(221,221,221,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#dddddd',GradientType=0 ); /* IE6-9 */
cursor:pointer;
}
#submit {
float: left;
margin-right:-1px;
overflow:hidden;
white-space:nowrap;
background: rgb(238,238,238); /* Old browsers */
background: -moz-linear-gradient(top, rgba(238,238,238,1) 0%, rgba(204,204,204,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(204,204,204,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
border-top-right-radius:4px;
border-bottom-right-radius:4px;
border:1px solid #AAA;
height:12px;
padding:6px 6px 6px 6px;
text-align:center;
font-size:11px;
font-family:Helvetica, sans-serif;
color:#666;
text-shadow:0px 1px 0px #e8eae5;
}
#submit:hover {
background: rgb(238,238,238); /* Old browsers */
background: -moz-linear-gradient(top, rgba(238,238,238,1) 0%, rgba(221,221,221,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(221,221,221,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(238,238,238,1) 0%,rgba(221,221,221,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#dddddd',GradientType=0 ); /* IE6-9 */
cursor:pointer;
}
.refineClicked {
background:white !important;
border-bottom-left-radius:0px !important;
border-bottom:none !important;
}
.arrow-down {
position: absolute;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #666;
right: 7px;
top: 10px;
}
#search {
float: left;
height: 24px;
margin-right:-5px;
padding: 0px 7px 0px 7px;
border:1px solid #AAA;
color:#444;
}
#search:focus { outline:none }
#refineDropdown {
position:relative;
top:40px;
left:30px;
width:150px;
max-height:200px;
background:#fff;
border-left:1px solid #AAA;
border-right:1px solid #AAA;
border-bottom:1px solid #AAA;
word-wrap:normal;
overflow:auto;
}
#dropdown {
top: 76px;
padding:3px;
width:200px;
max-height:200px;
background:#fff;
border-left:1px solid #CCC;
border-right:1px solid #CCC;
border-bottom:1px solid #CCC;
word-wrap:normal;
overflow:auto;
left: 59px;
position: absolute;
}
ul {
list-type:none;
margin:0;
padding:0;
}
li {
padding:5px 10px 5px 10px;
}
li:hover {
margin:-1px;
background:#E5F3FF;
border:1px solid #3366FF;
cursor:pointer;
}
.selected {
margin:-1px;
background: #E5F3FF;
border:1px solid #3366FF;
}
.hidden { display:none }
I believe the reason you want this to be done with relative positioning is that you believe absolute positioning is always absolute in relation to the page. Surprise: it isn't.
In fact, what it is absolute to is the first parent that has its position attribute set. As such, the simple solution could be to wrap your entire widget into a div and declare the position of that div as relative.
For example:
<p>adsadds
<div class='container'>
<div class='absolutelyPositioned'>BlaBla</div>
</div>
sddasda</p>
With this css:
.container
{
position: relative;
}
.absolutelyPositioned
{
position: absolute;
top: 100px;
left: 100px;
}
will have the inner div with "BlaBla" in it position not at (100, 100) of the web page, but of the container div. In other words if I turn <p>adsadds into <p>adsadds <br /> the "BlaBla" will be pushed down as well.

create this shape using CSS3

I would like to create this shape using just css. I am pretty sure this can be done. But i am having trouble with gradients involved.
This shape will contain some text inside. Suggested html markup is:
<div class="container">
... more html contents...
</div>
A jsFiddle would be highly appreciated.
Thanks in advance.
Try this, http://jsfiddle.net/HshfF/1/
CSS: (From the fiddle in this comment)
.main {
background: -moz-linear-gradient(top, #ffffff 0%, #e8e8e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e8e8e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#e8e8e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#e8e8e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#e8e8e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#e8e8e8 100%); /* W3C */
position: relative;
width: 150px;
height: 100px;
margin: 10px;
border: 1px solid #d0d0d0;
border-radius: 10px;
padding: 20px;
}
.main:before {
content: '';
display: block;
top: -1px;
right: -1px;
width: 20px;
height: 20px;
background: -moz-linear-gradient(top, #ffffff 0%, #e8e8e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e8e8e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#e8e8e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#e8e8e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#e8e8e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#e8e8e8 100%); /* W3C */
position: absolute;
border-radius: 0 0 0 5px;
border-left: 1px solid #d0d0d0;
border-bottom: 1px solid #d0d0d0;
}
.main:after {
content: '';
display: block;
position: absolute;
top: -1px;
right: -1px;
border-top: 20px solid #fff;
border-left: 20px solid transparent;
}
Please Learn CSS3, Try Nicholas Gallagher tutorials, he has some of the best css3 tutorials:
one you looking for http://nicolasgallagher.com/pure-css-folded-corner-effect/demo/
The drop shadow and colors you looking for i think you need to do it yourself.
Nearly there with this: http://jsfiddle.net/Grezzo/52zG7/
You only need one div (thanks to pseudo element), but I haven't "cut" the corner yet.

CSS: How to create buttons with reflected shine similar to iOS icons?

I'm trying to style my HTML buttons using CSS, so that they have the reflected shine like the icons on iOS devices' home page. Apple does this to icons automatically as shown here. I need something similar to the shine in CSS.
Take a look at this fiddle.
Here's the code:
HTML:
<div class="icon">
<div class="shine"></div>
</div>
And CSS:
.icon {
width: 150px;
height: 150px;
border-radius: 30px;
background: red;
float: left;
margin: 50px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.5);
}
.shine {
background: -moz-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.2) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0.7)), color-stop(100%,rgba(255,255,255,0.2))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,0.7) 0%,rgba(255,255,255,0.2) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,0.7) 0%,rgba(255,255,255,0.2) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,0.7) 0%,rgba(255,255,255,0.2) 100%); /* IE10+ */
background: linear-gradient(top, rgba(255,255,255,0.7) 0%,rgba(255,255,255,0.2) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3ffffff', endColorstr='#33ffffff',GradientType=0 ); /* IE6-9 */
height: 90px;
width: 150px;
box-shadow: inset 0px 2px 1px rgba(255, 255, 255, 0.7);
border-top-right-radius: 30px;
border-top-left-radius: 30px;
border-bottom-right-radius: 100px 40px;
border-bottom-left-radius: 100px 40px;
}
my example uses a background-color:red instead of an image, but just put any image as background in the #icon div and it should also work.
(btw I used this awesome site: http://www.colorzilla.com/gradient-editor/ for the gradients)
HTML:
<div class="icon">
<div class="shine">
</div>
</div>
CSS:
.icon {
width:50px;
height:50px;
background-color: red;
overflow: hidden;
position: relative;
}
.shine {
position: absolute;
top: -70px;
left: -25px;
width:100px;
height:100px;
border-radius: 50px;
background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 150%); /* Chrome10+,Safari5.1+ */
background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 150%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(255,255,255,1.5)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 150%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 150%); /* IE10+ */
background: radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 150%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
Hope it works for you!

Resources