I wanted to customise a nice spinner in CSS to indicate loading and it works nicely and looks great in everything except for Mozilla. Can anyone explain to me why, and how to fix it? Or at least point me in the right direction.
<style>
.loader {
display: inline-flex;
width: 0.75em;
height: 0.75em;
border-radius: 50%;
outline: none;
position: relative;
animation: rotate 1s linear infinite
}
.loader::before {
content: "";
box-sizing: border-box;
position: absolute;
inset: 0px;
border-radius: 50%;
border: 0.15em solid;
animation: prixClipFix 1.8s linear infinite;
}
:is(h1, h2, h3, h4, h5) .loader::before {
border-width: 0.1em;
}
#keyframes rotate {
100% {
transform: rotate(360deg)
}
}
#keyframes prixClipFix {
0% {
clip-path: polygon(50% 50%, 0 0, 10% 0, 10% 0, 10% 0, 10% 0)
}
25% {
clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0)
}
50% {
clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 100% 100%, 100% 100%)
}
75% {
clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0)
}
100% {
clip-path: polygon(50% 50%, 0 0, 10% 0, 10% 0, 10% 0, 10% 0)
}
}
</style>
<div>
<!-- <div class="spin"></div> -->
<h1>Loading
<div class="loader"></div>
</h1>
<h2>Loading
<div class="loader"></div>
</h2>
<h3>Loading
<div class="loader"></div>
</h3>
<h4>Loading
<div class="loader"></div>
</h4>
<h5>Loading
<div class="loader"></div>
</h5>
Loading
<div class="loader"></div>
</div>
Looking into it, I found that FF doesn't appreciate the div rotating while the polygon grows and shrinks. Turning either one off solves the problem however I would like it to do both.
Thanks to Miriam it is now fixed! I added border-radius: 0.01px; and overflow: hidden; to the .loader parent class.
Related
I am trying to make a CSS marquee whose text fades in from the right edge and fades out on the left edge. Only the letters on the edges should turn transparent. I'd call it an "opacity mask" that is feathered onto the left/right edges.
I can find CSS marquee code samples but none with such a fade in/out effect. I'd also like the background to be completely transparent, with just the text having the edge effects.
I've tried adding a gradient to the container but, in hind sight, that doesn't seem to be the right path. Below is the code I've come up with thus far. Please assist, thanks!
#Bernard Borg: I've updated my code with the second new sample. Other than this not using opacity - and therefore being A) dependent on being hardcoded to the underlying background color and B) only working on a solid background - this is acceptable for my use case. Thanks! (Any idea how to cover the marquee with opacity rather than a color?)
div#container {
width: 60%;
height: 100%;
position: absolute;
background-color: #e6e9eb;
}
div#marquee-container {
overflow: hidden;
}
p#marquee {
animation: scroll-left 10s linear infinite;
}
#keyframes scroll-left {
0% {transform: translateX( 140%)}
100% {transform: translateX(-140%)}
}
div#marquee-cover {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 40px;
background: linear-gradient(to right, rgba(230, 233, 235, 1) 0%, rgba(230, 233, 235, 0) 15%, rgba(230, 233, 235, 0) 85%, rgba(230, 233, 235, 1) 100%);
}
<div id="container">
<div id="marquee-container">
<p id="marquee">The quick brown fox jumps over the lazy dog</p>
<div id="marquee-cover"/> <!--thanks Bernard Borg-->
</div>
</div>
For anyone coming to this question in the future - the answer to this question was a joint effort. Find the answer in the question.
This is the closest I was able to get to your updated question;
body {
margin: 0;
}
#container {
width: 100%;
height: 100vh;
background-color: grey;
display: flex;
align-items: center;
}
#marquee-container {
overflow: hidden;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
}
p#marquee {
font-family: 'Segoe UI', sans-serif;
font-size: 30px;
font-weight: bold;
height: 80%;
animation: scroll-left 5s linear infinite;
white-space: nowrap;
}
#first-cover,
#second-cover {
height: 100vw;
backdrop-filter: opacity(50%);
width: 30vw;
z-index: 100;
}
#first-cover {
background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(128, 128, 128, 0.2));
}
#second-cover {
background: linear-gradient(-90deg, rgba(0, 0, 0, 0.8), rgba(128, 128, 128, 0.2));
}
#keyframes scroll-left {
0% {
transform: translateX(130%);
}
100% {
transform: translateX(-130%);
}
}
<div id="container">
<div id="marquee-container">
<div id="first-cover"></div>
<p id="marquee">The quick brown fox jumps over the lazy dog</p>
<div id="second-cover"></div>
</div>
</div>
For some reason backdrop-filter (specifically with opacity) isn't doing anything. Weird.
Edit:
You could probably define an image for the background of the marquee (with gradients on each side) and then use mix-blend-mode in some way to fade the text. Perhaps I'm overcomplicating this. ¯\(ツ)/¯
Animate the opacity property (cleaned up the code for better readability);
body {
margin: 0;
}
div#marquee-container {
width: 600px;
height: 150px;
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 15%, rgba(255, 255, 255, 1) 85%, rgba(255, 255, 255, 0) 100%);
}
p#marquee {
text-align: right;
animation: scroll-left 10s linear infinite;
}
#keyframes scroll-left {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
transform: translateX(-80%);
opacity: 0;
}
}
<div style="background-color: black; width: 100%; height: 100%;">
<div id="marquee-container">
<p id="marquee">Testing</p>
</div>
</div>
Side note: You don't need vendor prefixes for animation anymore.
div#container {
width: 100%;
height: 100%;
position: absolute;
background-color: grey;
}
div#marquee-container {
width: 600px;
height: 150px;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 15%, rgba(255,255,255,1) 85%, rgba(255,255,255,0) 100%);
}
p#marquee {
width: 80%;
height: 80%;
--opacity: 0;
moz-animation: scroll-left 1s linear infinite;
-webkit-animation: scroll-left 1s linear infinite;
animation: scroll-left 10s linear infinite;
}
#-moz-keyframes scroll-left {
0% {-moz-transform: translateX( 100%);}
100% {-moz-transform: translateX(-100%);}
}
#-webkit-keyframes scroll-left {
0% {-webkit-transform: translateX( 100%)}
100% {-webkit-transform: translateX(-100%)}
}
#keyframes scroll-left {
0% {-moz-transform: translateX( 100%); -webkit-transform: translateX( 100%); transform: translateX( 100%); opacity: 0;}
30%{
opacity: 1;
}
60%{
opacity: 0;
}
100% {-moz-transform: translateX(-100%); -webkit-transform: translateX(-100%); transform: translateX(-100%);opacity: 0; }
}
}
<div id="container">
<div id="marquee-container">
<p id="marquee">Testing</p>
</div>
</div>
I'm working in React js and am trying to emulate the vertical move up animation you see on the text "A DIGITAL DESIGN STUDIO
DRIVEN BY RESEARCH &
STRATEGY" here - https://dashdigital.studio/
From inspecting this site I have tried working with their translation CSS -
transition-delay: .9s;
transition: transform 1.3s cubic-bezier(.075, .82, .165, 1);
transform: translateY(0%);
However there is the "moving up from behind a wall" effect in use that I can't find a starting point for. Ideally I'd have this occur to elements on scroll - is there a package or starting point for anything like this?
How can I create this vertical wipe from behind a wall effect?
You can create vertically animation by following this code
html, body {
height: 100%;
}
body {
font-family: "Baloo Paaji", cursive;
background: #1e90ff;
display: flex;
justify-content: center;
align-items: center;
}
.container {
width: 400px;
height: 220px;
position: relative;
}
h1, h2 {
font-size: 75px;
text-transform: uppercase;
}
h1 span, h2 span {
width: 100%;
float: left;
color: #ffffff;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
transform: translateY(-150px);
opacity: 0;
-webkit-animation-name: titleAnimation;
animation-name: titleAnimation;
-webkit-animation-timing-function: ease;
animation-timing-function: ease;
-webkit-animation-duration: 3s;
animation-duration: 3s;
}
h1 span {
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
-webkit-animation-fill-mode: forwards;
}
h1 span:first-child {
-webkit-animation-delay: 0.7s;
animation-delay: 0.7s;
}
h1 span:last-child {
color: #ffe221;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
h2 {
top: 0;
position: absolute;
}
h2 span {
-webkit-animation-delay: 4.1s;
animation-delay: 4.1s;
-webkit-animation-fill-mode: forwards;
}
h2 span:first-child {
-webkit-animation-delay: 4.2s;
animation-delay: 4.2s;
}
h2 span:last-child {
color: #ffe221;
-webkit-animation-delay: 4s;
animation-delay: 4s;
}
.usechrome {
font-size: 10px;
color: #fff;
font-family: helvetica, arial;
position: absolute;
bottom: 20px;
width: 100%;
text-align: center;
left: 0;
}
#-webkit-keyframes titleAnimation {
0% {
transform: translateY(-50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
80% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
100% {
transform: translateY(50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
}
}
#keyframes titleAnimation {
0% {
transform: translateY(-50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
80% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
100% {
transform: translateY(50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
}
}/*# sourceMappingURL=style.css.map */
<section class="container">
<h1 class="title">
<span>Hi, nice</span>
<span>to see</span>
<span>you here</span>
</h1>
<h2 class="title">
<span>This is</span>
<span>a long</span>
<span>sub title</span>
</h2>
</section>
<span class="usechrome">Use Chrome for a better experience</span>
I'm having a bit of trouble trying to center my div class= content onto the middle right under the word freedom. Any help? I also have an image provided here https://gyazo.com/8a38955c74369034a014b20ed8e5d31d
HTML
<p id="einz" style="color: rgb(255, 255, 255);">
<!--marquee direction="right" speed="1" onmouseover="this.stop();" onmouseout="this.start();"-->
[ <a id="einz" href="bla bla bla" target="blank" rel=noopener>discord</a> /
<a id="einz" href="bla bla bla" target="blank" rel=noopener>steam</a> /
<a id="einz" href="bla bla bla" target="blank" rel=noopener>youtube</a> /
<a id="einz" href="bla bla bla" target="blank" rel=noopener>github</a> ]
CSS
```#einz
{
text-align: center;
font-weight: normal;
font-family: 'Courier', sans-serif;
text-shadow: 1px 1px 1px rgba(0,0,0,100), 1px 1px 1px rgba(0,0,0,100);
margin: 0 auto;
z-index: 1;
font-size: 12px;
}
Following your CodePen demo, you have to put the freedom text and links in a wrapper and then center the wrapper in order to keep the respectiveness to the text and links. Further on, since you wanted the links to the bottom-right of the freedom text, the links had to be put in a wrapper as well. Since you wanted the links on two different levels, I'd recommend using blocks to force a new line rather than <br>. You should also refrain from using the style attribute when the element has a class that you can alter. You should also not use similar id attributes more than once, you should refer to using classes instead.
/* temporary code to not blind the view */
body { background: pink }
#freedom-wrapper {
position: absolute;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -220px;
}
#freedom-links-wrapper {
float: right;
}
.freedom-links {
color: rgb(255, 255, 255);
font-weight: normal;
font-size: 12px;
font-family: 'Courier', sans-serif;
text-align: center;
text-shadow: 1px 1px 1px rgba(0,0,0,100),
1px 1px 1px rgba(0,0,0,100);
line-height: 18px;
z-index: 1;
}
.glitch {
color: white;
font-size: 100px;
z-index: 1;
}
/* old code */
#keyframes noise-anim {
0% {
clip-path: inset(87% 0 4% 0);
}
5% {
clip-path: inset(3% 0 43% 0);
}
10% {
clip-path: inset(82% 0 4% 0);
}
15% {
clip-path: inset(41% 0 2% 0);
}
20% {
clip-path: inset(96% 0 5% 0);
}
25% {
clip-path: inset(57% 0 35% 0);
}
30% {
clip-path: inset(78% 0 4% 0);
}
35% {
clip-path: inset(100% 0 1% 0);
}
40% {
clip-path: inset(99% 0 1% 0);
}
45% {
clip-path: inset(46% 0 49% 0);
}
50% {
clip-path: inset(16% 0 8% 0);
}
55% {
clip-path: inset(16% 0 72% 0);
}
60% {
clip-path: inset(19% 0 80% 0);
}
65% {
clip-path: inset(8% 0 9% 0);
}
70% {
clip-path: inset(88% 0 6% 0);
}
75% {
clip-path: inset(32% 0 30% 0);
}
80% {
clip-path: inset(46% 0 47% 0);
}
85% {
clip-path: inset(78% 0 21% 0);
}
90% {
clip-path: inset(60% 0 9% 0);
}
95% {
clip-path: inset(48% 0 49% 0);
}
100% {
clip-path: inset(23% 0 64% 0);
}
}
.glitch::after {
content: attr(data-text);
position: absolute;
left: 2px;
text-shadow: -1px 0 red;
top: 0;
overflow: hidden;
animation: noise-anim 2s infinite linear alternate-reverse;
}
#keyframes noise-anim-2 {
0% {
clip-path: inset(19% 0 72% 0);
}
5% {
clip-path: inset(6% 0 35% 0);
}
10% {
clip-path: inset(32% 0 35% 0);
}
15% {
clip-path: inset(97% 0 3% 0);
}
20% {
clip-path: inset(19% 0 57% 0);
}
25% {
clip-path: inset(85% 0 16% 0);
}
30% {
clip-path: inset(46% 0 46% 0);
}
35% {
clip-path: inset(83% 0 15% 0);
}
40% {
clip-path: inset(66% 0 18% 0);
}
45% {
clip-path: inset(90% 0 8% 0);
}
50% {
clip-path: inset(58% 0 34% 0);
}
55% {
clip-path: inset(38% 0 61% 0);
}
60% {
clip-path: inset(93% 0 6% 0);
}
65% {
clip-path: inset(4% 0 83% 0);
}
70% {
clip-path: inset(57% 0 38% 0);
}
75% {
clip-path: inset(97% 0 4% 0);
}
80% {
clip-path: inset(9% 0 57% 0);
}
85% {
clip-path: inset(7% 0 82% 0);
}
90% {
clip-path: inset(14% 0 54% 0);
}
95% {
clip-path: inset(94% 0 6% 0);
}
100% {
clip-path: inset(9% 0 49% 0);
}
}
.glitch::before {
content: attr(data-text);
position: absolute;
left: -2px;
text-shadow: 1px 0 blue;
top: 0;
color: palevioletred;
overflow: hidden;
animation: noise-anim-2 15s infinite linear alternate-reverse;
}
<div id="freedom-wrapper">
<div class="glitch" data-text="freedom">freedom</div>
<div id="freedom-links-wrapper">
<div class="freedom-links">
[
discord
/
steam
/
youtube
/
github
]
</div>
<div class="freedom-links">
[ <a class="toggle">ᴄʟɪᴄᴋ ᴍᴇ</a> ]
</div>
</div>
</div>
target="blank" is also invalid and should be target="_blank". As another note, you can refer to using :after pseudo elements on <a> elements to add a slash when the element is not the last in its child (:not(:last-child):after).
As a final note, refer to not using plain-text "fonts" and use actual fonts instead. Talking about the click me text. You should also not trust your predefined pixel offsets for the freedom margin.
id is unique.
Don’t use id to control the style, use class instead, id is generally used to process data.
<p class="center">
[
title 1
title 2
]
</p>
.center { text-align: center; }
I was wondering if it was possible to split a screen into 2 parts diagonally as shown on the picture. Once I'd hover over Picture A, the diagonal line would shift a bit to the right, revealing more of picture A while hiding a bit of picture B (I'm thinking transition?), and when I'd hover over picture B the opposite would happen.
Thanks in advance,
Martin
The diagonal image transition effect is unique request. I tried my best, Can you please check revealing effect.
section {
border: 1px solid black;
display: flex;
width: 400px;
box-sizing: border-box;
}
.diagonalHover {
position: absolute;
width: 66%;
height: 200px;
transition: all 0.3s ease-out;
}
.diagonalHover.first,
.diagonalHover.second {
background-image: url(https://cdn.pixabay.com/photo/2016/07/20/22/33/vajdahunyadvar-1531470_960_720.jpg);
background-repeat: no-repeat;
background-size: cover;
}
.diagonalHover.second {
background-image: url(https://cdn.pixabay.com/photo/2020/02/05/22/17/vendetta-4822543__340.jpg);
}
.diagonalHover.first:hover {
width: 75%;
z-index: 1;
}
.diagonalHover.second:hover {
width: 75%;
z-index: 1;
}
.diagonalHover.first:hover + .second {
}
.diagonalHover.first {
left: 0;
top: 0;
-webkit-clip-path: polygon(0 0, 100% 0%, 50% 100%, 0% 100%);
clip-path: polygon(0 0, 100% 0%, 50% 100%, 0% 100%);
}
.diagonalHover.second {
right: 0;
top: 0;
-webkit-clip-path: polygon(50% 0, 100% 0%, 100% 100%, 0% 100%);
clip-path: polygon(50% 0, 100% 0%, 100% 100%, 0% 100%);
}
<section>
<div class="diagonalHover first">
</div>
<div class="diagonalHover second">
</div>
</section>
i want to make a shape like this using CSS 3, but i couldn't rotate the border like this.
Is there any way to make this using css only?
i thought about a class like this:
border: 0px solid #1C6EA4;
border-radius: 40px 0px 0px 0px;
-ms-transform: rotate(-20deg); /* IE 9 */
-webkit-transform: rotate(-20deg); /* Safari */
transform: rotate(-20deg);
but i didn't get the wanted result
UPDATE:
in found this but it still needs some edits to be like the wanted one
-webkit-clip-path: polygon(30% 0%, 100% 0, 100% 30%, 100% 100%, 70% 100%, 30% 100%, 14% 66%, 0% 30%);
clip-path: polygon(30% 0%, 100% 0, 100% 30%, 100% 100%, 70% 100%, 30% 100%, 14% 66%, 0% 30%);
It can be done with CSS only:
.outer {
border: 1px solid #ddd;
overflow: hidden;
height:300px;
width:300px;
}
.image-container {
border-radius: 40px 0px 0px 0px;
transform: rotate(-20deg) translateX(100px) translateY(50px);
overflow: hidden;
}
.image-container img {
transform: rotate(20deg) translateX(-100px);
}
<div class="outer">
<div class="image-container">
<img src="http://lorempixel.com/400/400" />
</div>
</div>