Background image linear-gradient animate opacity smoothly - css

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>

Related

CSS: animated offset image border

so, i'm trying to achieve this kind of animated border with css
sample of the border
the sample animated css is:
#keyframes bg {
0% {
background-size: 0 3px,
3px 0,
0 3px,
3px 0;
}
25% {
background-size: 100% 3px,
3px 0,
0 3px,
3px 0;
}
50% {
background-size: 100% 3px,
3px 100%,
0 3px,
3px 0;
}
75% {
background-size: 100% 3px,
3px 100%,
100% 3px,
3px 0;
}
100% {
background-size: 100% 3px,
3px 100%,
100% 3px,
3px 100%;
}
}
div {
width: 25%;
margin: 2rem auto;
padding: 2em;
background-repeat: no-repeat;
background-image: linear-gradient(to right, #f5ca00 100%, #f5ca00 100%),
linear-gradient(to bottom, #f5ca00 100%, #f5ca00 100%),
linear-gradient(to right, #f5ca00 100%, #f5ca00 100%),
linear-gradient(to bottom, #f5ca00 100%, #f5ca00 100%);
background-size: 100% 3px,
3px 100%,
100% 3px,
3px 100%;
background-position: 0 0,
100% 0,
100% 100%,
0 100%;
animation: bg 1.25s cubic-bezier(0.19, 1, 0.22, 1) 1;
animation-play-state: paused;
}
div:hover {
animation-play-state: running;
}
<div>
<img src="https://moro.fund/wp-content/uploads/2020/08/scale-photo.png" alt="">
</div>
i just want the last animated line to be half and inside the image just like the sample at the start :)
please note that is gonna be used inside wordpress.
any kind of help or guidance is appreciated.
Try to add to div styles with :after pseudo class and animate it on hover or on initail animations.
#keyframes bg {
0% {
background-size: 0 3px,
3px 0,
0 3px,
3px 0;
}
25% {
background-size: 100% 3px,
3px 0,
0 3px,
3px 0;
}
50% {
background-size: 100% 3px,
3px 100%,
0 3px,
3px 0;
}
75% {
background-size: 100% 3px,
3px 100%,
100% 3px,
3px 0;
}
100% {
background-size: 100% 3px,
3px 100%,
100% 3px,
3px 100%;
}
}
div {
width: 25%;
margin: 2rem auto;
padding: 2em;
background-repeat: no-repeat;
background-image: linear-gradient(to right, #f5ca00 100%, #f5ca00 100%),
linear-gradient(to bottom, #f5ca00 100%, #f5ca00 100%),
linear-gradient(to right, #f5ca00 100%, #f5ca00 100%),
linear-gradient(to bottom, #f5ca00 100%, #f5ca00 100%);
background-size: 100% 3px,
3px 100%,
100% 3px,
3px 100%;
background-position: 0 0,
100% 0,
100% 100%,
0 100%;
animation: bg 1.25s cubic-bezier(0.19, 1, 0.22, 1) 1;
animation-play-state: paused;
position: relative;
}
div:hover {
animation-play-state: running;
}
div:after{
content: '';
width: 2px;
height: 0;
background: #f5ca00;
position: absolute;
right: 0;
top: 0;
transition: height .3s ease;
}
div:hover:after {
height: 100px;
}
<div>
<img src="https://moro.fund/wp-content/uploads/2020/08/scale-photo.png" alt="">
</div>

Is it possible to fill in the background color so there's no white? I am using the clip-path css property in this screenshot

https://imgur.com/a/ZTZp4
Codepen: https://codepen.io/yongelee/pen/eVobRd
I want to make the background have no white, so basically have that white space as the color of the next block's background. But unfortunately when I clip-path, the div doesn't change from a rectangle to a trapezoid!
My code (JSX):
<Wrapper>
<HeroBlock>
<h1>hi</h1>
<h4>hihi</h4>
</HeroBlock>
<IntroBlock>
<h1>heyyy</h1>
<h4>YO??</h4>
</IntroBlock>
<SkillsBlock>
<h1>Heyy</h1>
<h4>okkk</h4>
</SkillsBlock>
</Wrapper>
const Wrapper = styled.div`
display: grid;
grid-template-columns: 1fr;
`
const HeroBlock = styled.div`
background: skyblue;
height: 50vh;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
`
const IntroBlock = styled.div`
background: orange;
padding-bottom: 100px;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 90%);
clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 90%);
`
const SkillsBlock = styled.div`
background: red;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
`
Using styled-components for this.
Simply consider some negative margin like this:
.container {
display: grid;
grid-template-columns: 1fr;
}
.hero {
background: skyblue;
height: 50vh;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
}
.intro {
margin-top: -40px;
background: orange;
padding-bottom: 100px;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 90%);
clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 90%);
}
.skills {
margin-top: -40px;
background: red;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
}
<div class="container">
<div class="hero">
<h1>Hey</h1>
<h4>heyy</h4>
</div>
<div class="intro">
<h1>Hii</h1>
<h4>Yoo</h4>
</div>
<div class="skills">
<h1>One</h1>
<h4>Noooo</h4>
</div>
</div>
Ok Here is what I came up with:
h1 {
margin-top:0;
}
.container {
display: grid;
grid-template-columns: 1fr;
}
.hero_cont {
background-color:orange;
}
.hero {
padding-top:21px;
background: skyblue;
height: 50vh;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
}
.intro_cont {
background-color:red;
}
.intro {
padding-top:21px;
background: orange;
padding-bottom: 100px;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 90%);
clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 90%);
}
.skills_cont {
background-color:transparent;
}
.skills {
padding-top:21px;
background: red;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
}
<div class="container">
<div class='hero_cont'>
<div class="hero">
<h1>Hey</h1>
<h4>heyy</h4>
</div>
</div>
<div class='intro_cont'>
<div class="intro">
<h1>Hii</h1>
<h4>Yoo</h4>
</div>
</div>
<div class='skills_cont'>
<div class="skills">
<h1>One</h1>
<h4>Noooo</h4>
</div>
</div>
</div>
i'd like to add clip path into div not stricte to section. I can clip div, and i can make linear-gradient on section, so section up to clip-path is for example red, so top of my section where is clip is also red, and bottom blue, bc next section gonna be blue. It seperate nice content :D
.section-stats {
background: linear-gradient(to bottom, rgb(247, 247, 247), rgba(0, 0, 0, 0));
position: relative;
width: 100%;
padding: 5rem 0;
// this is element which we want to clip
&--clip {
height: 100%;
width: 100%;
padding: 10rem 0;
background-image: linear-gradient(
to right bottom,
rgba(0, 0, 0, 0.6),
rgba(0, 0, 0, 0.6)
),
url("../../img/renovation-tools.jpeg");
background-size: cover;
background-position: top;
background-attachment: fixed;
-webkit-clip-path: polygon(100% 0, 100% 90%, 50% 100%, 0 90%, 0 0, 50% 10%);
clip-path: polygon(100% 0, 100% 80%, 50% 100%, 0 80%, 0 0, 50% 20%);
}
& .row {
margin: 20rem 0 10rem;
}
&--icon {
font-size: 10rem;
color: $color-secondary-light;
#include respond(tab-port) {
font-size: 6rem;
}
}
&--count {
display: block;
font-size: 7rem;
color: $color-secondary-light;
margin-top: -2rem;
#include respond(tab-port) {
font-size: 5rem;
}
}
&--sub {
display: inline-block;
transform: translateY(0.8rem);
}
}
<section class="section-stats ">
<div class="section-stats--clip u-flex">
<div class="row">
<div class="col-1-of-3 u-center-text">
<i class="lni lni-apartment section-stats--icon"></i>
<span class="section-stats--count"
>2<span class="section-stats--sub">3</span>8</span
>
<h3 class="heading-tertiary heading-white">COMPLETED PROJECTS</h3>
</div>
<div class="col-1-of-3 u-center-text">
<i class="lni lni-apartment section-stats--icon"></i>
<span class="section-stats--count"
>7<span class="section-stats--sub">5</span>1</span
>
<h3 class="heading-tertiary heading-white">COMPLETED PROJECTS</h3>
</div>
<div class="col-1-of-3 u-center-text">
<i class="lni lni-apartment section-stats--icon"></i>
<span class="section-stats--count"
>7<span class="section-stats--sub">5</span>1</span
>
<h3 class="heading-tertiary heading-white">COMPLETED PROJECTS</h3>
</div>
</div>
</div>
</section>

Drawing border colors during a CSS transition

button {
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
position: relative;
vertical-align: middle;
}
button::before, button::after {
box-sizing: inherit;
content: " ";
position: absolute;
width: 100%;
height: 100%;
}
.draw {
transition: color 0.25s;
}
.draw::before, .draw::after {
border: 2px solid transparent;
width: 0;
height: 0;
transition: width 1.25s ease-out 1.25s, height 1.25s ease-out 1.25s;
}
.draw::before {
top: 0;
left: 0;
}
.draw::after {
bottom: 0;
right: 0;
}
.draw:hover {
color: #60daaa;
}
.draw:hover::before, .draw:hover::after {
width: 100%;
height: 100%;
}
.draw:hover::before {
border-top-color: #60daaa;
border-right-color: #60daaa;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.draw:hover::after {
border-bottom-color: #60daaa;
border-left-color: #60daaa;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
<section class="buttons">
<button class="draw">Draw</button>
</section>
I have a working pen ( https://codepen.io/anon/pen/vdgdxO ) that changes the border color of an element while hovering ( top right bottom left ) with some transition to smoothen it up.
I would like to be able to "reverse" the border color change after a few seconds. Basically, I'd like to change border color when the opposite one is changing color :
border-top change color
border-right change color
border-bottom change color & border-top goes back to its original color
border-left change color & border-right goes back to its original color
border-top change color & border-bottom goes back to its original color
border-right change color & border-left goes back to its original color
etc.
Right now I only have the color change worked out, but I don't know how to "reverse" it. I'd also like this transition to loop forever, but I'm clueless on where to start. Any suggestions?
I would use multiple linear-gradient and a complex animation (by animating size/position of each one) to obtain the final result. If you get the trick you can easily adjust the different values to obtain any animation you want.
.draw {
padding: 20px 50px;
outline:none;
border: none;
box-shadow: none;
background-image:
linear-gradient(#f45e61, #f45e61),
linear-gradient(#f45e61, #f45e61),
linear-gradient(#f45e61, #f45e61),
linear-gradient(#f45e61, #f45e61),
linear-gradient(#60daaa, #60daaa),
linear-gradient(#60daaa, #60daaa),
linear-gradient(#60daaa, #60daaa),
linear-gradient(#60daaa, #60daaa);
background-position: 0 0, 0 0, 0 100%, 0 100%,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 0% 3px, 0% 3px, 3px 0%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
background-color:transparent;
background-repeat:no-repeat;
transition:0.2s linear;
}
.draw:hover {
background-position: 0 100%, 0 0, 0 100%, 100% 0,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 0%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
animation: animate 1.4s linear infinite 0.2s;
}
#keyframes animate {
0% {
background-position: 0 100%, 0 0, 0 100%, 100% 0,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 0%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
}
40% {
background-position: 0 100%, 100% 0, 100% 100%, 100% 0,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 100%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
}
60% {
background-position: 0 100%, 100% 0, 100% 100%, 100% 100%,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 0% 3px, 100% 3px,3px 100%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
}
70% {
background-position: 0 100%, 100% 0, 0% 100%, 100% 100%,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 100%, 0% 3px, 100% 3px,3px 0%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
}
80% {
background-position: 0% 0%, 0% 0, 0% 100%, 100% 100%,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 100%, 0% 3px, 0% 3px,3px 0%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
}
100% {
background-position: 0% 0%, 0 0, 0 100%, 100% 100%,
0 0, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 0%,
3px 100%, 100% 3px, 100% 3px,3px 100%;
}
}
<button class="draw">Draw</button>
How does it work?
The structure: We have 8 linear-gradient. 4 will simply create the initial border and won't move (they are placed at the bottom layer) and 4 will be used to draw the line that will create our animation above the initial border (they are placed at the top layer).
The order is important as within background properties we will have 8 values each one for each gradient. You will notice the 3px value that will simply specify the width or height of each gradient (similar to the border-width) and it won't change during the animation.
The animation: I will adjust position/size of each gradient to create the animation. it's divided into 2 parts: a small transition and a big animation. The transition is simply used to create the initial state of the animation that's why the duration used for the transition is the same as the delay of the animation.
The first step is to animate the top border from left to right. To do this the gradient should be positioned at (0,0) [top,left] with a size of 0% 3px [width height]. Then I simply change the size to 100% 3px and I will get the needed animation (the 3px as described before won't change).
Now to animate the second border we do the same. We need a gradient positioned at (100%,0) [top,right] with a size of 3px 0% [width height] that we animate to 3px 100%:
Now since we have two borders we need to animate the third one AND hide the first one. I won't detail the third border as it's similar to the above ones so let's see how to hide the top one. The first intuitive idea is to simply set its size back to 0% 3px but this will simply create the inverse animation and thus we will have a right to left animation which is bad. The trick here is to adjust the position of the gradient to make it (100%,0) [top,right] instead of (0,0) as both positions are equivalent when the gradient is 100% size (so we do this at the previous step when animating the second one). Now, we can put back the size to 0% 3px and we will have a left to right animation:
We continue the same logic until we get back to the initial state and by specifying infinite in the animation property we will have the needed effect.
So the main Idea is to have a gradient with the size equal to 0% that we animate to full size (100%) in a given direction then we change its position (this won't have any effect on full size) and then animate back its size to 0. We mix this with the 4 gradients we have.
UPDATE
To avoid the confusing with all these gradient here is an update where I used a pseudo element for the static border thus we keep only 4 gradients for the animation:
.draw {
position:relative;
padding: 20px 50px;
outline:none;
border: none;
box-shadow: none;
background-image:
linear-gradient(#f45e61, #f45e61),
linear-gradient(#f45e61, #f45e61),
linear-gradient(#f45e61, #f45e61),
linear-gradient(#f45e61, #f45e61);
background-position: 0 0, 0 0, 0 100%, 0 100%;
background-size: 3px 0%, 0% 3px, 0% 3px, 3px 0%;
background-color:transparent;
background-repeat:no-repeat;
transition:0.2s linear;
}
.draw:before {
content:"";
position:absolute;
z-index:-1;
top:0;
right:0;
left:0;
bottom:0;
border:3px solid #60daaa;
}
.draw:hover {
background-position: 0 100%, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 0%;
animation: animate 1.4s linear infinite 0.2s;
}
#keyframes animate {
0% {
background-position: 0 100%, 0 0, 0 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 0%;
}
40% {
background-position: 0 100%, 100% 0, 100% 100%, 100% 0;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 100%;
}
60% {
background-position: 0 100%, 100% 0, 100% 100%, 100% 100%;
background-size: 3px 0%, 0% 3px, 100% 3px,3px 100%
}
70% {
background-position: 0 100%, 100% 0, 0% 100%, 100% 100%;
background-size: 3px 100%, 0% 3px, 100% 3px,3px 0%;
}
80% {
background-position: 0% 0%, 0% 0, 0% 100%, 100% 100%;
background-size: 3px 100%, 0% 3px, 0% 3px,3px 0%;
}
100% {
background-position: 0% 0%, 0 0, 0 100%, 100% 100%;
background-size: 3px 0%, 100% 3px, 0% 3px,3px 0%
}
}
<button class="draw">Draw</button>

CSS radial gradient drop shadow - reversed

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);
}

Radial gradient background pattern

I'm trying to achieve the effect below with pure CSS3. I think that repeating-radial-gradient is the right path to take, but I can't figure out how to get the radial gradient to go "from big to small" horizontally. Any advice?
This is the closest I've gotten jsfiddle. It's close, but it doesn't go "from big to small" horizontally.
.dotted {
padding: 2.25em 1.6875em;
background-color: #ffb55d;
background-image: -webkit-repeating-radial-gradient(center center, #ff9d4b, #ff9d4b 2px, transparent 2px, transparent 100%);
background-image: -moz-repeating-radial-gradient(center center, #ff9d4b, #ff9d4b 2px, transparent 2px, transparent 100%);
background-image: -ms-repeating-radial-gradient(center center, #ff9d4b, #ff9d4b 2px, transparent 2px, transparent 100%);
background-image: repeating-radial-gradient(center center, #ff9d4b, #ff9d4b 2px, transparent 2px, transparent 100%);
-webkit-background-size: 5px 5px;
-moz-background-size: 3px 3px;
background-size: 5px 5px;
}
Much Closer to what you are looking for:
.dotted {
height:100px;
width:100%;
background: radial-gradient(orange 15%, transparent 16%) 1px 1px,
radial-gradient(orange 15%, transparent 16%) 8px 8px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
background-color:#ffb55d;
background-size:16px 16px;
}
Modified jbutler483's find on codepen (just for fun) (with Chrome):
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div style="background: rgba(0,0,0,1);">
<div class='halftone' height='100px'></div>
<div class='halftone2' height='100px'></div>
</div>
<style>
* {
margin: 0;
padding: 0;
position: relative;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
div {
height: 100%;
background-color: 0;
}
.halftone {
/*
size progressively decreasing
*/
background-image: radial-gradient(circle, dodgerblue 85%, transparent 0), radial-gradient(circle, dodgerblue 80%, transparent 0), radial-gradient(circle, dodgerblue 75%, transparent 0), radial-gradient(circle, dodgerblue 70%, transparent 0), radial-gradient(circle, dodgerblue 65%, transparent 0), radial-gradient(circle, dodgerblue 60%, transparent 0), radial-gradient(circle, dodgerblue 55%, transparent 0), radial-gradient(circle, dodgerblue 50%, transparent 0), radial-gradient(circle, dodgerblue 45%, transparent 0), radial-gradient(circle, dodgerblue 40%, transparent 0), radial-gradient(circle, dodgerblue 35%, transparent 0), radial-gradient(circle, dodgerblue 30%, transparent 0), radial-gradient(circle, dodgerblue 25%, transparent 0), radial-gradient(circle, dodgerblue 20%, transparent 0);
/*
change all other values when changing this.
I suppose this'd be easier to do in Sass.
*/
background-size: 1em 1em;
/*
If you want a vertical pattern change to repeat-x, also remember to switch the background-positions' values. Eg. "2em 0" becomes "0 2em".
*/
background-repeat: repeat-y;
/*
based on background-size value
*/
background-position: 0 0, 1em 0, 2em 0, 3em 0, 4em 0, 5em 0, 6em 0, 7em 0, 8em 0, 9em 0, 10em 0, 11em 0, 12em 0, 13em 0;
}
.halftone2 {
/*
size progressively increasing
*/
background-image: radial-gradient(circle, dodgerblue 20%, transparent 0), radial-gradient(circle, dodgerblue 25%, transparent 0), radial-gradient(circle, dodgerblue 30%, transparent 0), radial-gradient(circle, dodgerblue 35%, transparent 0), radial-gradient(circle, dodgerblue 40%, transparent 0), radial-gradient(circle, dodgerblue 45%, transparent 0), radial-gradient(circle, dodgerblue 50%, transparent 0), radial-gradient(circle, dodgerblue 55%, transparent 0), radial-gradient(circle, dodgerblue 60%, transparent 0), radial-gradient(circle, dodgerblue 65%, transparent 0), radial-gradient(circle, dodgerblue 70%, transparent 0), radial-gradient(circle, dodgerblue 75%, transparent 0), radial-gradient(circle, dodgerblue 80%, transparent 0), radial-gradient(circle, dodgerblue 85%, transparent 0);
/*
change all other values when changing this.
I suppose this'd be easier to do in Sass.
*/
background-size: 1em .8em;
/*
If you want a vertical pattern change to repeat-x, also remember to switch the background-positions' values. Eg. "2em 0" becomes "0 2em".
*/
background-repeat: repeat-y;
/*
based on background-size value
*/
background-position: 0 0, 1em 0, 2em 0, 3em 0, 4em 0, 5em 0, 6em 0, 7em 0, 8em 0, 9em 0, 10em 0, 11em 0, 12em 0, 13em 0;
}
.halftone {
animation: rt 4s infinite;
animation-direction: alternate;
}
.halftone2 {
animation: rt2 4s infinite;
animation-direction: alternate;
}
#keyframes rt {
0% {
opacity: 0;
transform: rotateY(0deg);
}
25% {
opacity: 1
}
50% {
opacity: 0;
transform: rotateY(180deg);
}
75% {
opacity: 1
}
100% {
opacity: 0;
transform: rotateY(360deg);
}
}
#keyframes rt2 {
0% {
opacity: 1;
transform: rotateY(0deg) translateY(-405px);
}
25% {
opacity: 0
}
50% {
opacity: 1;
transform: rotateY(180deg) translateY(-405px);
}
75% {
opacity: 0
}
100% {
opacity: 1;
transform: rotateY(360deg) translateY(-405px);
}
}
</style>
Okay, looks like this isn't possible via CSS3. I did make it work with an image though, so I guess that's the best answer.

Resources