Have some pre-existing code from a Wordpress template that draws an ellipse drop shadow. The shadow radiates downward in an ellipse. Only the bottom half of the ellipse is visible, creating a bottom shadow effect.
I simply want to "reverse" the ellipse "shadow effect" so that only the top half of the shadow is visible. Seems simple. I'm lost.
What I believe is the code snippet drawing the radial shadow:
.fusion-separator.sep-shadow {
height: 1px;
overflow: visible;
border: none;
background: none;
background: linear-gradient(left, rgba(150, 150, 150, 0) 0%, rgba(150, 150, 150, 0) 15%, rgba(150, 150, 150, 0.65) 50%, rgba(150, 150, 150, 0) 85%, rgba(150, 150, 150, 0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#00000000', GradientType=1);
}
.fusion-separator.sep-shadow:after {
display: block;
margin-top: 10px;
height: 6px;
width: 100%;
content: '';
background: radial-gradient(ellipse at 50% -50%, rgba(0, 0, 0, 0.5) 0px, rgba(255, 255, 255, 0) 65%);
}
Live example on site:
Existing Radial Shadow
The radial-gradient that is used currently is positioned at 50% - 50% which is nothing but the point represented by the horizontal center of the container (in X axis) and a point that is half the height of the container above the container itself (in Y axis). For this case, it would be at (50%, -3px) and so only the bottom half of the ellipse is visible.
To make the top half of the ellipse visible, just adjust the positioning such that it is below the container instead of above it (that is, make it (50% + 100%) instead of (50% - 100%)). After this, I assume you would want it to be on top of the parent element and so position it absolutely with respect to the parent and then set top as -1 * height of the pseudo element.
background: radial-gradient(ellipse at 50% 150%, rgba(0, 0, 0, 0.5) 0px, rgba(255, 255, 255, 0) 65%);
.fusion-separator.sep-shadow {
position: relative;
height: 50px;
overflow: visible;
border: none;
background: linear-gradient(to left, rgba(150, 150, 150, 0) 0%, rgba(150, 150, 150, 0) 15%, rgba(150, 150, 150, 0.65) 50%, rgba(150, 150, 150, 0) 85%, rgba(150, 150, 150, 0) 100%);
}
.fusion-separator.sep-shadow:after {
position: absolute;
content: '';
top: -6px;
height: 6px;
width: 100%;
content: '';
background: radial-gradient(ellipse at 50% 150%, rgba(0, 0, 0, 0.5) 0px, rgba(255, 255, 255, 0) 65%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class='fusion-separator sep-shadow'></div>
You could also position it as 50% 100% like in the below snippet if you want the darker portion of the ellipse to be visible.
.fusion-separator.sep-shadow {
position: relative;
height: 50px;
overflow: visible;
border: none;
background: linear-gradient(to left, rgba(150, 150, 150, 0) 0%, rgba(150, 150, 150, 0) 15%, rgba(150, 150, 150, 0.65) 50%, rgba(150, 150, 150, 0) 85%, rgba(150, 150, 150, 0) 100%);
}
.fusion-separator.sep-shadow:after {
position: absolute;
content: '';
top: -6px;
height: 6px;
width: 100%;
content: '';
background: radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.5) 0px, rgba(255, 255, 255, 0) 65%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class='fusion-separator sep-shadow'></div>
Why don't try to rotate it?
.fusion-separator {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
Related
I am new to programming.
Is it possible to create a gradient like the background of this design using sass or css? I want to place some colors in random places.
Thank you in advance.
Yes you can by adding multiple gradient to you background property
W3scool doc
.container {
height: 100vh;
background:
radial-gradient(circle at 10% 20%, #FF000070 2%, transparent 40%),
radial-gradient(circle at 70% 40%, #BADA5570 4%, transparent 10%),
radial-gradient(ellipse at 50% 80%, #BADA5570 7%, transparent 30%);
}
<div class="container"></div>
Yes, a similar effect might be achieved.
You can stack gradients by separating them with commas. The "white" color must be transparent so you can see through the uppermost gradients.
Take a look at this gradient:
div {
background:
radial-gradient(circle at 10px 30px, rgb(2, 0, 36) 0%, rgb(7, 6, 97) 31%, rgba(9, 9, 121, 0) 46%, rgba(0, 212, 255, 0) 100%),
radial-gradient(circle at 600px 400px, rgb(200, 0, 36) 0%, rgb(200, 6, 97) 31%, rgba(9, 9, 121, 0) 46%, rgba(0, 212, 255, 0) 100%);
width: 400px;
height: 400px;
}
<div></div>
Glassmorphism is the name of the effect.
Check this site Glassmorphism
.container{
background: rgba( 255, 255, 255, 0.25 );
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 );
backdrop-filter: blur( 10px );
-webkit-backdrop-filter: blur( 4.0px );
border-radius: 10px;
border: 1px solid rgba( 255, 255, 255, 0.18 );
width:100%;
height:100vh;
z-index:999;
}
.circle1{
position:absolute;
top:10px;
left:20px;
height:100px;
width:100px;
background:red;
opacity: 0.5;
border-radius:50%;
z-index:-1;
}
.circle2{
position:absolute;
bottom:10px;
right:20px;
height:250px;
width:250px;
opacity: 0.5;
background:blue;
border-radius:50%;
z-index:-1;
}
<div class="container"></div>
<div class="circle1"></div>
<div class="circle2"></div>
I want to do this animation when the user goes to the page, the image changes the position and also adds a linear gradient to the image, something like this:
Video of how it should be
But this is what I have:
What I have
I just want to make the linear-gradient animation smooth... This is the code I'm using:
.bg-image {
background-image: linear-gradient(
rgba(0, 0, 0, 0.6),
rgba(0, 0, 0, 0.6)
),
url("Background.jpg");
background-position: 50% 100%;
animation: backgroundPosition 4s ease-in;
}
#keyframes backgroundPosition {
from {
background-image: linear-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0)
),
url("Background.jpg");
background-position: 50% 0%;
}
to {
background-image: linear-gradient(
rgba(0, 0, 0, 0.6),
rgba(0, 0, 0, 0.6)
),
url("Background.jpg");
background-position: 50% 100%;
}
}
gradients can not be animated for color, or alpha, they can only be animated for position.
Set your gray layer to a bigger dimension in horizonatl, and make it a real gradint, goping from transparent to whatever level of gray you want.
Then, animate also the horizontal position of the gradient, from the transparent side to the gray side
.bg-image {
height: 400px;
width: 400px;
background-image: linear-gradient(to right,
rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8)
),
url("http://placekitten.com/400/800");
background-position: 0% 50%;
background-repeat: no-repeat;
background-size: 1000% 100%, 100% 200%;
animation: backgroundPosition 4s ease-in infinite;
}
#keyframes backgroundPosition {
from {
background-position: 0% 0%, 0% 50%;
}
to {
background-position: 100% 0%, 0% 100%;
}
}
<div class="bg-image"></div>
I Want to color a button just like this. Is there any way i can do this by using css?
Button should look like this
You can use a linear gradient.
JSFiddle
button {
height: 50px;
width: 100px;
background: linear-gradient(-60deg, red 50%, yellow 50%);
}
<button></button>
Using something like this
.x{
height: 50px;
background: #ff3232;
background: -moz-linear-gradient(-45deg, #ff3232 0%, #ff3030 50%, #282fff 51%, #005dff 100%);
background: -webkit-linear-gradient(-45deg, #ff3232 0%,#ff3030 50%,#282fff 51%,#005dff 100%);
background: linear-gradient(135deg, #ff3232 0%,#ff3030 50%,#282fff 51%,#005dff 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff3232', endColorstr='#005dff',GradientType=1 );
}
<div class="x">
</div>
HTML:
<button id="main"></button>
CSS:
#main {
width: 200px;
height: 50px;
border: none;
background: linear-gradient(120deg, rgb(255, 0, 144), rgb(255, 0, 144) 55%, rgb(0, 222, 255), rgb(0, 222, 255) 45%);
}
Codepen
Hello i want to have this kind of effect with an image (which is not a background image) :
Do u have any idea how i can create this effect with css ?
Look at this:
img {
width: 400px;
}
.content {
background: rgba(255, 255, 255, 0) linear-gradient(to bottom, rgba(0, 0, 0, 0) 10%, rgba(255, 255, 255, .1) 40%, rgba(255, 255, 255, .5) 75%, rgba(255, 255, 255, 1) 100%) repeat scroll 0 0;
position: relative;
margin-top: -200px;
height: 200px;
}
<img src="http://www.dl.21tech.ir/img-upload/2016/12/95092801.jpg" />
<div class="content"></div>
You can use a container with gradient, outside the img and set negative z-index of image to push it behind container.
<div class="gradient-bg">
<img src="http://img.phombo.com/img1/photocombo/1634288/hd-wallpapers-scenic-desktop-wallpaper-beautiful-fresh-nature-scenery-sunrise-1920x1080-wallpaper.jpg">
<span>Hello There</span>
</div>
.gradient-bg{
display: inline-block;
background: -moz-linear-gradient(bottom, rgba(0,0,0,0) 0%, rgba(249, 249, 249, 0.89) 100%);
background: -webkit-gradient(linear, left bottom, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(249, 249, 249, 0.89) 100%);
background: -o-linear-gradient(bottom, rgba(0,0,0,0) 0%,rgba(249, 249, 249, 0.89) 100%);
background: -ms-linear-gradient(bottom, rgba(0,0,0,0) 0%,rgba(249, 249, 249, 0.89) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(249, 249, 249, 0.89) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 );
}
span{
position: absolute;
top: 183px;
}
img{
position:relative;
z-index:-1;
display:block;
height:200px; width:auto;
}
Use image height width and gradient accordingly.
This is sample code for the solution
I am wondering if some CSS guru can give me some idea of how to build this background pattern without using the div tags as used here - http://codepen.io/juanbrujo/pen/IrAfF
The css would be
.back {
position: absolute;
width: 99%;
height: 99%;
background: linear-gradient(180deg, #6e529d 0%, #d97b93 100%);
overflow: hidden;
}
.back:after {
content: "";
position: absolute;
width: 200%;
height: 200%;
left: -50%;
top: 0px;
-webkit-transform: rotate(-45deg);
-webkit-transform-origin: top left;
background-image: linear-gradient(44.9deg, rgba(255, 255, 255, 0.05) 0%, rgba(128, 128, 128, 0.05) 7.18em, transparent 7.16em),
linear-gradient(225deg, rgba(0, 0, 0, 0.05) 0%, rgba(128, 128, 128, 0.05) 7.18em, transparent 7.16em),
linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0%, rgba(128, 128, 128, 0.05) 25%, transparent 25%),
linear-gradient(225deg, rgba(0, 0, 0, 0.05) 0%, rgba(128, 128, 128, 0.05) 25.391%, transparent 25%);
background-size: 20em 20em;
background-position: 0em 0em, 10em 10em, 10em 10em, 0em 0em;
}
fiddle
Another approach, without need to use absolute positioning
body, html {
width: 100%;
height: 100%;
}
body {
position: relative;
overflow: hidden;
}
body:after {
content: "";
position: absolute;
width: 200%;
height: 200%;
left: -50%;
top: 0px;
-webkit-transform: rotate(-45deg);
-webkit-transform-origin: center;
background-image: linear-gradient(44.9deg, rgba(255, 255, 255, 0.05) 0%, rgba(128, 128, 128, 0.05) 7.18em, transparent 7.16em),
linear-gradient(225deg, rgba(0, 0, 0, 0.05) 0%, rgba(128, 128, 128, 0.05) 7.18em, transparent 7.16em),
linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0%, rgba(128, 128, 128, 0.05) 25%, transparent 25%),
linear-gradient(225deg, rgba(0, 0, 0, 0.05) 0%, rgba(128, 128, 128, 0.05) 25.391%, transparent 25%);
background-size: 20em 20em;
background-position: 0em 0em, 10em 10em, 10em 10em, 0em 0em;
}
body:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient(180deg, #6e529d 0%, #d97b93 100%);
}
And using 100% dimensions :-)
demo2