Vertically align a radial gradient - css

I've setup the following jsfiddle = https://jsfiddle.net/gfxjwuao/
.skeleton-yqjgac1o2g6:empty {
height: 133px;
background-color: red;
border-radius: 0px 0px 0px 0px;
background-image: radial-gradient( circle 20px at 20px 20px, #F5F7F9 19px, transparent 20px );
background-repeat: repeat-y;
background-size: 40px 133px;
background-position: center center;
}
<div class="skeleton-yqjgac1o2g6"></div>
All I want to do is vertically align the circle. I can horizontally center it all fine, but it just seems to ignore it vertically. Any ideas?
Using background-position: center center is ignored.

Tried it like this, changing the coordinates of radial-gradient to "center":
.skeleton-yqjgac1o2g6:empty {
height: 133px;
background-color: red;
border-radius: 0px 0px 0px 0px;
background-image: radial-gradient( circle 20px at center, #F5F7F9 19px, transparent 20px );
background-repeat: repeat-y;
background-size: 40px 133px;
background-position: center center;
}
<div class="skeleton-yqjgac1o2g6"></div>
Just a noob, though.
Can't really explain it.

Just change background-image radial graidient y to 50%. or just copy paste answer below and look for reasoning by yourself. :)
.skeleton-yqjgac1o2g6:empty {height: 133px; background-color: red; border-radius: 0px 0px 0px 0px; background-image: radial-gradient( circle 20px at 20px 50%, #F5F7F9 19px, transparent 20px );background-repeat: repeat-y;background-size: 40px 133px;background-position: 50% 50%;vertical-align: center;}

Related

Skew GradientBackground Whitespace

It's hard to see but on the INSIDE of the Border, left and right side only of the skewed rectangle, there is whitespace which is only there if I have a gradient background
https://imgur.com/a/fDcD8bi
my css:
padding: 50px 0;
margin: 0;
border-radius: 15px;
border-radius: 0;
border: 4px solid #717171;
transform: skewX(352deg);
box-shadow: -5px 10px 10px 0px #0b0b0b2b;
cursor: pointer;
background: rgb(41,41,41);
background: -moz-linear-gradient(15deg, rgba(41,41,41,1) 0%, rgba(59,59,59,1) 100%);
background: -webkit-linear-gradient(15deg, rgba(41,41,41,1) 0%, rgba(59,59,59,1) 100%);
background: linear-gradient(15deg, rgba(41,41,41,1) 0%, rgba(59,59,59,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#292929",endColorstr="#3b3b3b",GradientType=1);
Any CSS magicians could help me with the whitespace on the inside? as I'd like to have the rectangle skewed with a gradient. But they don't work together so well. Thanks

Can you create this fading strip using only CSS?

Can I create this using css?
there's some box-shadow css I can use to create the bottom border, but how do you create the effect on the left and right sides?
Yes you can: https://jsfiddle.net/0mro5t77/
The trick is to use an outer and an inner container. The outer container provides the white background for the bar and the box shadow. The inner container has a gradient "page background color -> transparent -> page background color" and is positioned absolutely so it overlaps the outer container to create the fading effect.
html, body {
background: #ccc;
}
.outer {
box-shadow: 0 -20px 20px -20px #333, 0 20px 20px -20px #333;
background: #fff;
width: 600px;
height: 50px;
margin: 0 auto;
}
.inner {
width: 600px;
height: 100px;
background: linear-gradient(to right, #ccc 0%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 75%, #ccc 100%);
position: absolute;
margin-top: -25px;
text-align: center;
padding-top: 30px;
}

Safari: background-clip and border-radius don't work well together

Fiddle
The div.button in the fiddle looks like expected in Chrome/FF but background-clip and border-radius don't work well in Safari.
Is there something wrong with code or its just how Safari behaves?
CSS
div.button {
width: 100px; height: 100px;
padding: 8px;
border-radius: 100px;
box-shadow: 0 0.8px 8px rgba(0,0,0,.3);
background-image: -webkit-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: -moz-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: -ms-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: -o-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: radial-gradient(center center, circle, #8CE2FB, #52D2F8);
-webkit-background-clip: content-box;
-moz-background-clip: content-box;
background-clip: content-box;
}
HTML
<div class="button"></div>
You may need to give specific size values to the gradient.
http://dabblet.com/gist/5748608 (prefix not written but added via js)
div.button {
width: 100px; height: 100px;
padding: 8px;
border-radius: 100px;
box-shadow: 0 0.8px 8px rgba(0,0,0,.3);
background-image: radial-gradient(center, #8CE2FB 0, #52D2F8 52px, white 52px , white );/* oldest, includes your safari ? */
background-image: radial-gradient(circle at center, #8CE2FB 0, #52D2F8 52px, white 52px , white ); /* newest */
}
.bshad {/* box- shadow */
width: 100px; height: 100px;
padding: 8px;
border-radius: 100px;
box-shadow: 0 0.8px 8px rgba(0,0,0,.3), inset 0 0 1px 8px white, inset 0 0 0 200px #52D2F8 ;
}
Box-shadow gives better result though.

How to create a shape with one slanted side and rounded corners on the opposite side?

Is it possible to create this shape in CSS3? How?
I am stuck: http://dabblet.com/gist/2962169
h1 {
background-color: #434b82;
border-radius: 20px 0 0 20px;
transform: skew(-20deg);
}
<h1>TEST</h1>
You mean somthing like this
h1 {
background-color: #434b82;
border-radius: 20px 0 0 20px;
width:500px;
height:40px;
border-right: 40px solid transparent;
}
h1:after{
position:absolute;
width: 80px;
border-top: 40px solid #434b82;
margin-left:500px;
border-right: 20px solid transparent;
content:"";
}
<h1></h1>​
We can use linear-gradient() to draw this shape on rectangular element.
This trick uses the idea of dividing whole shape in two parts and then draws each part on the background independently.
div {
background-image: linear-gradient(to left, #434b82, #434b82),
linear-gradient(to left top, transparent 50%, #434b82 50%);
background-position: top right 20px, 100% 100%;
background-size: 100% 100%, 20px 100%;
background-repeat: no-repeat;
}
div {
background-image: linear-gradient(to left, #434b82, #434b82),
linear-gradient(to left top, transparent 50%, #434b82 50%);
background-position: top right 20px, 100% 100%;
background-size: 100% 100%, 20px 100%;
background-repeat: no-repeat;
border-radius: 30px 0 0 30px;
line-height: 50px;
padding: 0 25px;
height: 50px;
width: 200px;
color: #fff;
}
<div>
Some Text Here...
</div>

CSS3 Pie background image doesnt show

I am using CSS3 pie and am calling it by attached js files just before the head tag.
For some reason my background image inst appearing. I have tried the standard adding z-index and position relative fixes but it doesn't show. Any help guidance appreciated.
Below is the css.
.linkButton {
background: url('../Images/linkButtonBg.png') 100% 9px no-repeat #dc5c00;
background: url('../Images/linkButtonBg.png') 100% 9px no-repeat, -webkit-gradient(linear, 0% 0% 0% 100% from(#e36000), to(#c85400));
background: url('../Images/linkButtonBg.png') 100% 9px no-repeat, -webkit-linear-gradient(top, #e36000, #c85400);
background: url('../Images/linkButtonBg.png') 100% 9px no-repeat, -moz-linear-gradient(top, #e36000, #c85400);
background: url('../Images/linkButtonBg.png') 100% 9px no-repeat, -ms-linear-gradient(top, #e36000, #c85400);
background: url('../Images/linkButtonBg.png') 100% 9px no-repeat, -o-linear-gradient(top, #e36000, #c85400);
-pie-background: url('../Images/linkButtonBg.png') 100% 9px no-repeat #000;
padding: 10px 10px 10px 11px;
display: inline-block;
color: #ffffff;
font-weight: bold;
box-shadow: inset 0 1px 0 0 #ff801e, 0 0 1px 1px #ffffff, 0 0 1px 1px #ffffff;
border: 1px solid #c85400;
text-shadow: #813700 2px 2px 1px;
line-height: 12px;
margin-bottom: 7px;
width: 326px;
display: block!important;
position:relative;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;`enter code here`
z-index:1;
}
First of all you don't need -pie-background for plain old image + background color.
If you do want to use -pie remember that paths are relative to html not css.
(I assume that you've set up mime-type etc and pie works for you in different cases.)
.linkButton{
behavior: url(PIE.htc);
}
Also, try adding a .index file with the following content in the same location as the PIE.htc file:
more info http://css3pie.com/
http://css3pie.com/documentation/
Try linking it without dots and slash like this:
-pie-background: url('Images/linkButtonBg.png') 100% 9px no-repeat #000;

Resources