HTML Academy
The battle, part 1
2D Transforms9/32
Back to the list of tasks
  • 1. Moving objects horizontally
  • 2. Moving objects vertically
  • 3. Fireball training
  • 4. Increasing and decreasing the size
  • 5. Defending the city
  • 6. The beginning of the journey
  • 7. The maze
  • 8. The battle, part 1
  • 9. The battle, part 2
  • 10. Test: The mysterious card
  • 11. The battle, part 3
  • 12. Test: The shattered crystal
  • 13. The final battle
  • 14. Features of transform-origin, part 1
  • 15. Features of transform-origin, part 2
  • 16. Features of transform-origin, part 3
  • 17. Features of transform-origin, part 4
  • 18. Centering with transform: translate
  • 19. Rotating the text in blocks
  • 20. Rotating the text in the background
  • 21. Custom shadows
  • 22. On-hover effects: buttons, part 1
  • 23. On-hover effects: buttons, part 2
  • 24. On-hover effects: buttons, part 3
  • 25. On-hover effects: the gallery
  • 26. The “stack” of cards
  • 27. Preparing the round menu
  • 28. Round menu, step 1
  • 29. Round menu, step 2
  • 30. Round menu, step 3
  • 31. The round menu, final part
  • 32. Test: Arranging the cards
Test: The mysterious card
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

The battle, part 2

While spending the night in an uncomfortable cave, Pendalf decided to pass the time by learning some more CSS magic.

There is still another feature of CSS transforms: skewing an object along the X and Y axes at a given angle. You can skew objects using the skewX and skewY functions.

The skew angle is set in degrees (deg). For example:

transform: skewX(45deg)
transform: skewY(30deg)

For the X-axis, a positive angle skews the object to the left, and a negative angle skews the object to the right. For the Y-axis, positive and negative values skew objects down and up, respectively.

In the example below, the first block is skewed 25° to the left, and in the second it is skewed 25° down:

transform: skewX (25deg);transform: skewY (25deg);

Note that in addition to skewX and skewY there is a generalizing function skew, which takes two arguments: skew(skew-along-X [, skew-along-Y]). The Y-axis skew value is an optional argument, and the default value is 0. However, at the same time, the behavior of the skew function differs from the simultaneous use of skewX and skewY during a transform. It has turned out that over time skew only continues to be supported in browsers to ensure legacy content compatibility, and it has even been excluded from the working draft of the CSS specification. Generally speaking, it is better to use skewX and skewY instead of skew.

So, what do you think? As soon as Pendalf learned the new spell, a cave monster, who somewhat resembled a dragon, came to visit him. Something told Pendalf that he wouldn’t be able to persuade his guest to leave simply by throwing fireballs…

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>The battle, part 2</title> <meta charset="utf-8"> <link rel="stylesheet" href="world.css"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="world underworld"> <div class="wizard"></div> <div class="monster"></div> </div> </body> </html>
CSS
.wizard { top: 244px; left: 50px; } .monster { }

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. Skew the .monster monster 30° in the horizontal direction.
    2. And then show him who is boss by skewing him 30° in the vertical direction.
    1. Open the scroll.

    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.