DEV Community

Cover image for 13 CSS Tricks that will give you an adrenaline rush🤯

13 CSS Tricks that will give you an adrenaline rush🤯

Smitter on July 17, 2023

CSS is gaining powers with recent web evolution. And it is very clever with tricks that were long existing or that have emerged. Perhaps tricks sha...
Collapse
 
samuel-braun profile image
Samuel Braun

Great Article!! Lets keep it going 😂
Image description

We can use background-clip text to make text have a gradient:

h2 {
    background: -webkit-linear-gradient(45deg, gold, lightblue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
Enter fullscreen mode Exit fullscreen mode

Beware of cross-browser support though. If you want to support pretty much all browsers you can use svg instead to achieve the same effect:

<svg width="100%" height="100%">
  <defs>
    <linearGradient id="Gradient" x1="0" x2="1" y1="0" y2="0">
      <stop offset="0%" stop-color="orange" />
      <stop offset="100%" stop-color="purple" />
    </linearGradient>
  </defs>

  <text x="50%" y="50%" font-family="Verdana" font-size="35" text-anchor="middle" fill="url(#Gradient)">
    Gradient Text
  </text>
</svg>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
smitterhane profile image
Smitter

Great technique,
The svg tactic is new to me and its a clever way for cross browser compat

Collapse
 
olsard profile image
olsard

Great, bookmarked, thanks for sharing.

Collapse
 
smitterhane profile image
Smitter

welcome, also share the article to let others know

Collapse
 
artydev profile image
artydev

Thank you

Collapse
 
smitterhane profile image
Smitter

You are always welcome

Collapse
 
mhadi2003 profile image
Mahdi

Awesome 👌

Collapse
 
smitterhane profile image
Smitter

welcome again

Collapse
 
samanmahmood profile image
Saman Mahmood

I appreciate you giving these kind hints.

Collapse
 
smitterhane profile image
Smitter

Welcome mahmood, i believe you got smarter after reading the article

Collapse
 
dasheck0 profile image
Stefan Neidig

Loled at 3 :D

Collapse
 
smitterhane profile image
Smitter

Sure that was an adrenaline rush you felt

Collapse
 
stackritesh profile image
Spirit

Great Article! Thanks!!!

Collapse
 
smitterhane profile image
Smitter

Thanks spirit,
Definitely you should follow me for more great articles

Collapse
 
ant_f_dev profile image
Anthony Fung

Some handy tips here - thanks for sharing.

Collapse
 
smitterhane profile image
Smitter

Welcom, glad you found it useful

Collapse
 
jenap profile image
Jenap User

Amazing content thanks

Collapse
 
smitterhane profile image
Smitter

Welcome Jenap, follow for more useful content i emit

Collapse
 
mheyrie profile image
Mheyrie

Brilliant…thank you for sharing..

Will definitely try them out

Collapse
 
smitterhane profile image
Smitter

Welcome, I'm glad you found it useful