HTML Academy
Round menu, step 1
2D Transforms29/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
Round menu, step 3
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Round menu, step 2

The menu items contain links. A block type, size, and background have been set for them: these source styles just need to be uncommented.

In the previous step, we rotated and skewed the menu items, but at the same time we also skewed their contents, that is, the links. To return them to their normal appearance, you need to “deskew” them by skewing them in the reverse direction.

We will “deskew” them by skewing them by the opposite angle, that is, by -30°.

It is more difficult to calculate the reverse angle. Here is the formula:

[reverse angle] = -1 * (90° – ([sector angle] / 2))

In our case, we get:

[reverse angle] = -1 * (90° - (60° / 2)) = -60°

Pay attention to the following order of transforms for the links: first skew, then rotate.

And there is one more important detail to cover. We need to offset the links so that they can fit in the inner half of the menu items. Let’s use margins to do this.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Round menu, step 2</title> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <nav class="circle-menu"> <div class="center"></div> <ul> <li><a href="#">monitor</a></li> <li><a href="#">aperture</a></li> </ul> </nav> </body> </html>
CSS
body { margin: 0; padding: 0; background-color: #f5f5f5; } .circle-menu { position: relative; width: 400px; height: 400px; margin: 50px auto; background-color: white; box-shadow: 0 0 3px #cccccc; } .circle-menu ul { position: absolute; width: 300px; height: 300px; margin: 50px; padding: 0; list-style: none; box-shadow: 0 0 0 1px #3498db; } .circle-menu .center { position: absolute; top: 195px; left: 195px; z-index: 1000; border: 5px solid #34495e; border-radius: 50%; box-shadow: 0 0 3px #cccccc; } .circle-menu li { position: absolute; top: -10px; left: -10px; width: 160px; height: 160px; background-color: rgba(145, 145, 145, 0.1); box-shadow: inset 0 0 1px #cccccc; transform-origin: 100% 100%; } .circle-menu li:nth-child(1) { transform: rotate(0deg) skew(30deg); } .circle-menu li:nth-child(2) { transform: rotate(60deg) skew(30deg); } /* .circle-menu li a { display: block; width: 160px; height: 160px; font-size: 0; background: rgba(241, 196, 15, 0.5) url("icons/monitor-4x.png") no-repeat 50% 40%; } */

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. Uncomment the CSS rule containing the links in the menu.
    2. Skew the links by -30°.
    3. And then additionally rotate them -60°.
    4. Add top and left margins to the links of 40px.

    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.