Problem: Liquid Button Morph Effect
Problem description
Given an HTML page containing a <button class="liquid-button">Click Me</button> element, write CSS to:
Style
.liquid-buttonwith padding, background color, text color,border-radius, andoverflow: hidden.Create a
::beforepseudo-element that covers the button (usingposition: absolute,top: -50%,left: -50%,width: 200%, andheight: 200%).Set the pseudo-element’s background to two radial gradients (
radial-gradient(circle at 25% 25%, rgba(255,255,255,0.5) 10%, transparent 50%)andradial-gradient(circle at 75% 75%, rgba(255,255,255,0.5) 15%, transparent 60%)) andbackground-size: 50% 50%.Apply
filter: blur(20px)andpointer-events: noneto the pseudo-element.Define a
@keyframes liquidanimation that rotates the pseudo-element 360° and translates it back and forth (0% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(25%,25%) rotate(180deg); } 100% { transform: translate(0,0) rotate(360deg); }).Apply the
liquidanimation to::beforewith a duration of3s,ease-in-out, and infinite iteration.
Goal
Write CSS rules to animate a blurred radial-gradient overlay inside the button, producing a continuous liquid sheen effect on hover (and optionally keeping it always active).
Constraints
Use only CSS (no JavaScript).
Button padding should be
1rem 2rem.Background color should be
#007BFFand text color should be#fff.Border radius should be
50px.Pseudo-element covers with
width: 200%,height: 200%,top: -50%, andleft: -50%.Background gradients as specified,
background-size: 50% 50%.Filter should be
blur(20px).Animation name should be
liquid.Animation duration should be
3s.Animation timing function should be
ease-in-out.Animation iteration count should be
infinite.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.
Problem: Liquid Button Morph Effect
Problem description
Given an HTML page containing a <button class="liquid-button">Click Me</button> element, write CSS to:
Style
.liquid-buttonwith padding, background color, text color,border-radius, andoverflow: hidden.Create a
::beforepseudo-element that covers the button (usingposition: absolute,top: -50%,left: -50%,width: 200%, andheight: 200%).Set the pseudo-element’s background to two radial gradients (
radial-gradient(circle at 25% 25%, rgba(255,255,255,0.5) 10%, transparent 50%)andradial-gradient(circle at 75% 75%, rgba(255,255,255,0.5) 15%, transparent 60%)) andbackground-size: 50% 50%.Apply
filter: blur(20px)andpointer-events: noneto the pseudo-element.Define a
@keyframes liquidanimation that rotates the pseudo-element 360° and translates it back and forth (0% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(25%,25%) rotate(180deg); } 100% { transform: translate(0,0) rotate(360deg); }).Apply the
liquidanimation to::beforewith a duration of3s,ease-in-out, and infinite iteration.
Goal
Write CSS rules to animate a blurred radial-gradient overlay inside the button, producing a continuous liquid sheen effect on hover (and optionally keeping it always active).
Constraints
Use only CSS (no JavaScript).
Button padding should be
1rem 2rem.Background color should be
#007BFFand text color should be#fff.Border radius should be
50px.Pseudo-element covers with
width: 200%,height: 200%,top: -50%, andleft: -50%.Background gradients as specified,
background-size: 50% 50%.Filter should be
blur(20px).Animation name should be
liquid.Animation duration should be
3s.Animation timing function should be
ease-in-out.Animation iteration count should be
infinite.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.