HTML Academy
The “stack” of cards
2D Transforms27/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 1
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Preparing the round menu

In this series of assignments, we will build a complex interface element in which transforms play a key role. This is the round menu.

The menu layout is the same as usual. Inside the <nav> tag you will find a regular list <ul> with several list items containing links.

We will demonstrate the approach by adding two menu items, and then we will add the rest of the items in the same way.

We have already prepared the source styles for the list and its items, and we also created an item that marks the center of the menu.

In order to rotate the list items in the menu, you need to position them correctly and set their rotation axis:

  • The axis should be in the lower right corner of the list item.
  • This angle should coincide with the center of the menu.

Use the transform-origin property as well as the positioning properties to solve this task

By the way, in order to ensure that we have a smooth menu, the menu items should flow slightly beyond the boundaries of the container.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Preparing the round menu</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="#"></a></li> <li><a href="#"></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 { width: 160px; height: 160px; background-color: rgba(145, 145, 145, 0.1); box-shadow: inset 0 0 1px #cccccc; }

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 an absolute position to the list items.
    2. Assign the value -10px to the properties top and left.
    3. And also assign the value 100% 100% to transform-origin.

    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.