I have wasted 2 days to create a shadow effect like here.
You see, the front white buttons look not flat, don't know how to describe. I bet this is because of box shadow effect, inset or something like that. But I can't make the same.
Can anyone help to make such a button with the same design, effect?
My example
.button {
background-size: 400% auto;
background: linear-gradient(to top right, rgb(247, 212, 167), #eef2f3);
border-radius: 7%;
box-shadow: inset 4px -4px 1px 1px rgb(252, 205, 144), inset -4px 4px 1px 1px white, -15px 25px 25px 0px rgba(0, 0, 0, .3);
width: 200px;
height: 200px;
-webkit-transition: all .1s linear;
transition: all .2s linear;
left: 0;
transform: rotate(45deg);
}
<div class="button main-circle"></div>
Here is an idea using some gradient and pseudo elements:
.box {
width: 100px;
height: 100px;
margin: 100px;
border: 3px solid #e0e1e6;
border-radius: 10px;
background: linear-gradient(to right, #b9b7dc, #a7a7c9);
transform: rotate(45deg);
position: relative;
z-index: 0;
box-sizing: border-box;
}
.box:before {
content: "";
position: absolute;
z-index: 2;
top: 30%;
left: -32%;
width: 100px;
height: 100px;
border: 3px solid #fefefe;
border-radius: 10px;
background: linear-gradient(to right, #e0e0e0, #fefefe);
box-sizing: border-box;
}
.box:after {
content: "";
position: absolute;
z-index: 1;
top: 30%;
left: -31%;
width: 100px;
height: 100px;
border-radius: 10px;
background: linear-gradient(to right, rgba(0,0,0,0.3),rgba(0,0,0,0.1));
box-sizing: border-box;
transform: skewY(11deg) scaleX(1.15);
filter: blur(4px);
transform-origin: top left;
}
body {
background: pink;
}
<div class="box"></div>
I want to remove the corners of borders like in
picture.
By now I have tried ::before and ::after pseudo elements but I was only able to remove two of the corners.
.rounded-corner-div{
min-height: 100px;
padding: 10px 20px;
border: 1px #000 solid;
position: relative;
}
.rounded-corner-div::after,
.rounded-corner-div::before {
background-color: white;
content: "";
display: block;
height: 10px;
position: absolute;
width: 10px;
}
.rounded-corner-div::after {
bottom: -1px;
right: -1px;
}
.rounded-corner-div::before {
top: -1px;
left: -1px;
}
<div class="rounded-corner-div"></div>
You can eventually use gradient and background-size:
.rounded-corner-div {
min-height: 100px;
padding: 10px 20px;
position: relative;
background: linear-gradient(to bottom, #000 1px, transparent 1px, transparent calc(100% - 1px), black calc(100% - 1px)) no-repeat, linear-gradient(to left, #000 1px, transparent 1px, transparent calc(100% - 1px), black calc(100% - 1px)) no-repeat;
background-position: center;
background-size: calc(100% - 1em) 100%, 100% calc(100% - 1em);
/* extra for demo */
display:flex;
align-items:center;
justify-content:center;
}
<div class="rounded-corner-div ">
test
</div>
If you still want to use pseudos elements, you can use them to draw the borders:
.rounded-corner-div {
min-height: 100px;
padding: 10px 20px;
position: relative;
}
.rounded-corner-div::after,
.rounded-corner-div::before {
content: "";
position: absolute;
pointer-events: none;
/* to click through anytime */
border: solid 1px;
}
.rounded-corner-div::after {
left: 10px;
right: 10px;
top: 0;
bottom: 0;
border-left: none;
border-right: none;
}
.rounded-corner-div::before {
top: 10px;
bottom: 10px;
left: 0;
right: 0;
border-top: none;
border-bottom: none;
}
<div class="rounded-corner-div"></div>
I am trying to use this ribbon code (found on some generator site)
link included
I think it looks nicev however it just doesn't fit the LONG line of text I need to display in there (PAST PRESIDENT).
This is the first time I'm trying to use a CSS ribbon effect.. and can not seem to wrap my head around what params will make move it over (to the left some)..and make it longer to display the longer text I want to display.
it's a right side justified ribbon (just to be clear).. that needs to be moved over to the left a little bit.. and made 'longer' to display longer text.
Here is my code:
/* CSS ribbon styles */
/* http://www.cssportal.com/css-ribbon-generator/ */
.ribbon {
position: absolute;
right: -5px; top: -5px;
z-index: 1;
overflow: hidden;
width: 75px; height: 75px;
text-align: right;
}
.ribbon span {
font-size: 10px;
font-weight: bold;
font-size:10px;
color: #FFF;
text-transform: uppercase;
text-align: center;
line-height: 20px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
width: 100px;
display: block;
background: #79A70A;
background: linear-gradient(#2989d8 0%, #1e5799 100%);
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 19px; right: -21px;
}
.ribbon span::before {
content: "";
position: absolute; left: 0px; top: 100%;
z-index: -1;
border-left: 3px solid #1e5799;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}
.ribbon span::after {
content: "";
position: absolute; right: 0px; top: 100%;
z-index: -1;
border-left: 3px solid transparent;
border-right: 3px solid #1e5799;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}
While I made it somewhat bigger using these updated styles..
the font looks a little 'janky'
I cant seem to get the before/after effects to adjust now that I have adjusted the other styles.
Updated:
.ribbon {
position: absolute;
right: -5px; top: -5px;
z-index: 1;
overflow: hidden;
width: 275px;
height: 275px;
text-align: right;
}
/* new bigger attempt */
.ribbon span {
background: rgba(0, 0, 0, 0) linear-gradient(#2989d8 0%, #1e5799 100%) repeat scroll 0 0;
box-shadow: 0 3px 10px -5px rgb(0, 0, 0);
color: #fff;
display: block;
font-size: 10px;
font-weight: bold;
line-height: 20px;
position: absolute;
right: -85px;
text-align: center;
text-transform: uppercase;
top: 32px;
transform: rotate(45deg);
width: 250px;
}
Try this. I updated the width/height/top/left on .ribbon and top/right on .ribbon span.
.box {
width: 200px;
height: 200px;
background: gainsboro;
position: relative;
}
/* CSS ribbon styles */
/* http://www.cssportal.com/css-ribbon-generator/ */
.ribbon {
position: absolute;
right: -6px;
top: -5px;
z-index: 1;
overflow: hidden;
width: 115px;
height: 115px;
text-align: right;
}
.ribbon span {
font-weight: bold;
font-size: 10px;
color: #FFF;
text-transform: uppercase;
text-align: center;
line-height: 20px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
width: 125px;
display: block;
background: linear-gradient(#2989d8 0%, #1e5799 100%);
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 28px;
right: -24px;
}
.ribbon span::before {
content: "";
position: absolute;
left: 0px;
top: 100%;
z-index: -1;
border-left: 3px solid #1e5799;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}
.ribbon span::after {
content: "";
position: absolute;
right: 0px;
top: 100%;
z-index: -1;
border-left: 3px solid transparent;
border-right: 3px solid #1e5799;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}
<div class="box">
<div class="ribbon"><span>PAST PRESIDENT</span></div>
</div>
So i've made some little tabs:
https://jsfiddle.net/pkpy08wy/2/
They display fine on chrome, and even fine on safari on iPad and iPhone. But on safari on a mac the background overlays the text.
Any ideas?
.address_tab {
position: relative;
display: inline-block;
padding: 10px 30px 8px;
color: #14528b;
margin-left: 20px;
}
.address_tab::before {
content: ''; /* To generate the box */
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
z-index: -999;
background: #d0d0d0;
background: -webkit-linear-gradient(left, #d0d0d0, #e8e8e8);
background: -o-linear-gradient(right, #d0d0d0, #e8e8e8);
background: -moz-linear-gradient(right, #d0d0d0, #e8e8e8);
background: linear-gradient(to right, #d0d0d0 , #e8e8e8);
transform: perspective(4px) rotateX(1deg);
border: 1px #b2b2b2 solid;
}
.address_tab::before {
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
<div class="address_tab">
Delivery Details
</div>
Ok, so i did stumble across this post http://katydecorah.com/code/z-index-and-transform/ which seems to have the solution for your problem. It's a good read by they way :)
Here's an updated fiddle for you https://jsfiddle.net/VilleKoo/a8zv69ka/
.address_tab {
position: relative;
display: inline-block;
padding: 10px 30px 8px;
color: #14528b;
margin-left: 20px;
transform-style: preserve-3d;
}
.address_tab::before {
content: ''; /* To generate the box */
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
background: #d0d0d0;
background: -webkit-linear-gradient(left, #d0d0d0, #e8e8e8);
background: -o-linear-gradient(right, #d0d0d0, #e8e8e8);
background: -moz-linear-gradient(right, #d0d0d0, #e8e8e8);
background: linear-gradient(to right, #d0d0d0 , #e8e8e8);
transform: perspective(4px) rotateX(1deg) translateZ(-1px);
border: 1px #b2b2b2 solid;
}
.address_tab::before {
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
<div class="address_tab">
Delivery Details
</div>
I have the following code that I took from http://cssdeck.com/labs/pure-css3-smooth-ribbon-with-borders
The HTML Code is:
<div id="ribbon">
<div class="inset"></div>
<div class="container">
<div class="base"></div>
<div class="left_corner"></div>
<div class="right_corner"></div>
</div>
The CSS Code is:
#ribbon {
width: 180px;
height: 280px;
margin: 0px;
position: relative;
overflow: hidden;
}
#ribbon .inset {
width: 200px;
height: 55px;
position: absolute;
top: -50px;
left: -10px;
z-index: 5;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: rgba(0,0,0,0.3);
box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.3);
-webkit-box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.3);
}
#ribbon .container {
position: relative;
width: 100px;
height: 250px;
overflow: hidden;
margin: 0 auto;
border-left: 1px solid #631a15;
border-right: 1px solid #631a15;
}
#ribbon .base {
height: 200px;
width: 100px;
background: rgb(199,59,60);
background: -moz-linear-gradient(top, rgba(199,59,60,1) 0%, rgba(184,32,31,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(199,59,60,1)), color-stop(100%,rgba(184,32,31,1)));
background: -webkit-linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
background: -o-linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
background: -ms-linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
background: linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c73b3c', endColorstr='#b8201f',GradientType=0 );
position: relative;
z-index: 2;
}
#ribbon .base:after {
content: '';
position: absolute;
top: 0;
width: 86px;
left: 6px;
height: 242px;
border-left: 1px dashed #631a15;
border-right: 1px dashed #631a15;
}
#ribbon .base:before {
content: '';
position: absolute;
top: 0;
width: 86px;
left: 7px;
height: 242px;
border-left: 1px dashed #da5050;
border-right: 1px dashed #da5050;
}
#ribbon .left_corner {
width: 100px;
height: 100px;
background: #b8201f;
position: absolute;
bottom: 20px;
left: -50px;
z-index: 1;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
#ribbon .right_corner {
width: 100px;
height: 100px;
background: #b8201f;
position: absolute;
bottom: 20px;
right: -50px;
z-index: 1;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
I want to increase the width (to 250px) and decrease the height (to 140px) of the ribbon.
how can i do this?
i am still studying CSS.
I also want to insert an image on top of the ribbon that is formed by the above coding.
Please help!
Here you go bro :) Check the DEMO1
DEMO2
#ribbon .base {
height: 140px;
width: 250px;
}
Have changed the .left_arrow and .right_arrow values to make it fit. Check it on Fiddle and ask me if you want any clarifications.
Width 250px and height 140px is done..
See this fiddle
HTML
<div id="ribbon">
<div class="inset"></div>
<div class="container">
<div class="base"></div>
<div class="left_corner"></div>
<div class="right_corner"></div>
</div>
</div>
CSS
#ribbon {
width: 350px;
height: 280px;
margin: 50px auto 0;
position: relative;
overflow: hidden;
}
#ribbon .container {
position: relative;
width: 250px;
height: 140px;
overflow: hidden;
margin: 0 auto;
border-left: 1px solid #631a15;
border-right: 1px solid #631a15;
}
#ribbon .base {
height: 80px;
width: 250px;
background: rgb(99,59,60);
background: -moz-linear-gradient(top, rgba(199,59,60,1) 0%, rgba(184,32,31,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(199,59,60,1)), color-stop(100%,rgba(184,32,31,1)));
background: -webkit-linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
background: -o-linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
background: -ms-linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
background: linear-gradient(top, rgba(199,59,60,1) 0%,rgba(184,32,31,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c73b3c', endColorstr='#b8201f',GradientType=0 );
position: relative;
z-index: 2;
}
#ribbon .base:after {
content: '';
position: absolute;
top: 0;
width: 234px;
left: 6px;
height: 132px;
border-left: 1px dashed #631a15;
border-right: 1px dashed #631a15;
}
#ribbon .base:before {
content: '';
position: absolute;
top: 0;
width: 234px;
left: 7px;
height: 132px;
border-left: 1px dashed #da5050;
border-right: 1px dashed #da5050;
}
#ribbon .left_corner {
width: 150px;
height: 100px;
background: #b8201f;
position: absolute;
bottom: 15px;
left: -45px;
z-index: 1;
-webkit-transform: rotate(50deg);
-moz-transform: rotate(50deg);
-ms-transform: rotate(50deg);
-o-transform: rotate(50deg);
transform: rotate(145deg);
}
#ribbon .right_corner {
width: 150px;
height: 100px;
background: #b8201f;
position: absolute;
bottom: 15px;
right: -45px;
z-index: 1;
-webkit-transform: rotate(35deg);
-moz-transform: rotate(35deg);
-ms-transform: rotate(35deg);
-o-transform: rotate(35deg);
transform: rotate(35deg);
}
#ribbon .inset {
width: 400px;
height: 55px;
position: absolute;
top: -50px;
left: -20px;
z-index: 5;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: rgba(0,0,0,0.3);
box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.3);
-webkit-box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.3);
}