HTML Academy
Challenge: Flags
Linear Gradients12/23
Back to the list of tasks
  • 1. Hello, linear-gradient!
  • 2. Gradient Direction
  • 3. Diagonal Gradients
  • 4. Gradients at an Angle
  • 5. Diagonals vs. Degrees
  • 6. Challenge: Application Icons
  • 7. Uniform Multicolor Gradient
  • 8. Color Proportions and Color Stops
  • 9. Sharp Color Transitions
  • 10. Pseudo-Columns on Gradients
  • 11. Challenge: Flags
  • 12. Color Transitions in px
  • 13. Semi-Transparent Gradients
  • 14. Repeating Linear Gradient
  • 15. Creating a Complex Background – Part 1
  • 16. Creating a Complex Background – Part 2
  • 17. Creating a Complex Background – Part 3
  • 18. Let’s Create a Complex Background – Final Step
  • 19. Buttons – Part 1
  • 20. Buttons – Part 2
  • 21. Buttons – Part 3
  • 22. Challenge: Ornament Made of Shurikens
  • 23. Challenge: Satellites
Semi-Transparent Gradients
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Color Transitions in px

Gradient color transitions can also be specified in pixels. They work in the same way as percentage transitions. The difference is that percentage transitions depend on the element size, but pixel transitions do not.

For this assignment, you need to complete the image by writing the gradients for the remaining leaves.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Color Transitions in px</title> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="flower"> <div class="leaf leaf-top-left"></div> <div class="leaf leaf-top-right"></div> <div class="leaf leaf-bottom-left"></div> <div class="leaf leaf-bottom-right"></div> </div> </body> </html>
CSS
.leaf-top-left { background-image: linear-gradient(-45deg, #f00000 30px, #000000 30px, #000000 40px, #ff0000 40px, #ff0000 70px, #000000 70px); } .leaf-top-right { /* colors: #00ff00, #000000, #00ff00, #000000 */ } .leaf-bottom-right { /* colors: #ffff00, #000000, #ffff00, #000000 */ } .leaf-bottom-left { /* colors: #ff00ff, #000000, #ff00ff, #000000 */ } .leaf-top-left, .leaf-bottom-right { border-radius: 0 50%; } .leaf-top-right, .leaf-bottom-left { border-radius: 50% 0; } .leaf { float: left; width: 150px; height: 150px; background-color: #dfdfdf; } .flower { margin: 70px auto; width: 300px; } html, body { margin: 0; padding: 0; }

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

    Finish painting the flower using sharp gradients:

    1. Assign a gradient at an angle of 45° to the top right leaf.
    2. Assign a gradient at an angle of 135° to the lower right leaf.
    3. Assign a gradient at an angle of 225° to the lower left leaf.

    The colors for the leaves are indicated in the comments in the CSS. The dimensions of the transitions are the same as the ones used for the first leaf.

    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.