HTML Academy
Rotating the text in blocks
2D Transforms20/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
Custom shadows
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Rotating the text in the background

Here’s another interesting effect that is created by transforming a rotation.

This time we will rotate the “background” text and also slightly skew the block with the heading using the skew function. And in order to make sure that just the block is skewed and not the text inside it, we should skew the text in the opposite direction by the same angle.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Rotating the text in the background</title> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="content"> <article> <h1><span>CSS3 rules!</span></h1> <p>border-radius border-image break-after break-before break-inside columns transition transition-delay transition-duration transition-timing-function transition-property backface-visibility perspective perspective-origin transform transform-origin transform-style background-clip background-origin background-size box-shadow box-decoration-break opacity @keframes animation animation-delay animation-direction animation-duration</p> </article> </div> </body> </html>
CSS
body { height: 100%; margin: 0; padding: 0; background-color: #2ecc40; color: #ffffff; font-family: "Arial Narrow", "Arial", sans-serif; } .content { height: 100%; overflow: hidden; } article { position: relative; } article h1 { position: relative; z-index: 1; width: 200px; margin: 100px auto; padding: 30px; font-size: 30px; text-align: center; background-color: black; } h1 span { display: inline-block; } article p { position: absolute; top: -200px; left: -150px; width: 150%; font-size: 50px; opacity: 0.15; }

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. Assign a skew of 15° to the right to the h1 header.
    2. Also assign a left skew of 15° to the span inside the heading.
    3. Rotate p inside article 15° counterclockwise.

    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.