HTML Academy
Invert and Saturate
CSS filters4/14
Back to the list of tasks
  • 1. Brightness and Contrast
  • 2. Grayscale and Sepia
  • 3. Invert and Saturate
  • 4. Color Rotation, hue-rotate
  • 5. Blur and Opacity
  • 6. Shadow, drop-shadow
  • 7. The Difference Between box-shadow and drop-shadow
  • 8. Applying CSS Filters to Text
  • 9. Challenge: Using Various Filters
  • 10. Combination of Filters
  • 11. Combining the drop-shadow Filters
  • 12. Animating CSS Filters
  • 13. Smooth Transitions and CSS Filters
  • 14. Challenge: Filter Combinations
Blur and Opacity
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Color Rotation, hue-rotate

The color that is offset by 60 degrees on the color wheel

Another interesting color filter is the hue-rotate color rotation. If we represent all of the colors as a wheel, then we can use this filter to rotate the image color along the wheel by a certain angle.

Thus, you can rotate colors using hue-rotate. The value is set in degrees, from 0deg to 360deg. You are also allowed to use a negative angle. A positive value will rotate the color clockwise, while a negative angle will rotate it counterclockwise. If the filter value is 0deg, then the element is displayed unchanged.

Examples:

.effect {
  filter: hue-rotate(90deg); /* Rotate clockwise by 90 degrees */
  filter: hue-rotate(-90deg); /* Rotate counterclockwise by 90 degrees */
}

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Color Rotation, hue-rotate</title> <link href="course.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body> <div class="image"> <img src="img/spb-1.jpg" alt=""> </div> <div class="compare"> <div class="compare-left hue-rotate"> <div class="image"> <img src="img/spb-1.jpg" alt=""> </div> </div> <div class="compare-right hue-rotate-reverse"> <div class="image"> <img src="img/spb-1.jpg" alt=""> </div> </div> </div> </body> </html>
CSS
.hue-rotate img { } .hue-rotate-reverse img { }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0
    1. For the image .hue-rotate img, assign the value 90deg to the hue-rotate filter,
    2. and then change the value to  270deg.
    3. For the image .hue-rotate-reverse img, apply a -180deg color rotation filter.

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.