HTML Academy
Round menu, step 2
2D Transforms30/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
The round menu, final part
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Round menu, step 3

The intermediate result doesn’t look very much like a round menu, but we just need to add a few more lines of CSS code, and everything will be transformed.

First of all, we will cut off the parts of links that protrude outside the menu items and get rid of redundant intersections. To do this, assign the hidden value to the overflow property for the list items.

Then we need to assign the menu a round shape.

To do this, we will work with the ul list itself, which now looks like a square with a blue border. Add the border-radius property with the value 50% to it, and the square will be transformed into a circle.

And then all that remains is to cut off everything lying outside the circle. And use overflow again.

The round menu consisting of two menu items is ready. You can remove the auxiliary backgrounds and frames.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Round menu, step 3</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; margin-top: 40px; margin-left: 40px; font-size: 0; background: rgba(241, 196, 15, 0.5) url("icons/monitor-4x.png") no-repeat 50% 40%; transform: skew(-30deg) rotate(-60deg); }

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. Set overflow: hidden for the list items.
    2. Assign border-radius: 50% to the list.
    3. And then also assign overflow: hidden.
    4. Remove the shadows and backgrounds from the list as well as the list items.

    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.