Advanced CSS3 Gradient Button
In today’s example we will study the “borin-ol-button” again and how to make cool gradient only using CSS3 gradient.
The principle is that we will create a separate background (with gradient) that is positioned in the button along side the text element that is above that background.
The trick here is to put overflow:hidden on button tag, that property will then hide any excessive background that would “stick-out” from the button.
Check the demo here:
Check the Demo
We will also test some key-frame animation on when you click the button.
Technologies: Stylus (CSS preprocessor) and HTML
CSS3 Gradient
In this example, we will exaggerate the use of gradient – so it is completely obvious … in real case, we would use a much subtler variant.
The button html
<button> <span class="btn-text"> Button </span> <span class="btn-bg"></span> </button>
The Stylus (CSS)
This is the whole code, including the on-click shaking animation.
blue = #3498DB button font-size 10px font-weight 400 background blue padding 20px 40px color white text-transform uppercase margin-bottom 20px border none border-radius 3px cursor pointer border none position relative overflow hidden margin 0px auto width 200px display block .btn-bg background linear-gradient(to bottom, lighten(blue,80%), lighten(blue,0%)) position absolute top -100% left 0px width 100% height 200% transition all 500ms ease &:hover .btn-bg transition 0.3s all ease top -150% .btn-text position relative z-index 1 &:focus outline none &:active animation shakeBtn 20ms infinite .btn-bg top -90% @keyframes shakeBtn 0% left -2px top -2px 50% right -2px top 2px 100% left 0px top 0px
We will be exploring more cases like this in the future .. stay tuned and take care.
Magical automated way of doing animations – with Stable diffusion with Deforum extension
Let’s explore the magical of doing animations – automated and unpredicable. Yes, you input the text prompt and have general control, but the magical part is, that you let the […]
Stable diffusion AI – high resolution generated art
What is Stable Diffusion AI? Stable Diffusion is a deep learning, text-to-image model released in 2022. It is primarily used to generate detailed images conditioned on text descriptions, though it […]
Tailwind CSS – Dream way of building UI and quick landing pages
This is a quick review and demo of the “utility style CSS framework” named “Tailwindcss” – https://tailwindui.com/ What is Tailwind CSS? Tailwind CSS is a utility-first CSS framework that provides […]
Blender 3D | Best way to start with 3D
It’s been a while since I done 3D stills and animations and 3D Blender seems to be perfect software to start, even if you have zero experience. I have to […]