Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7790417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:34:52+00:00 2026-06-01T21:34:52+00:00

I have been looking at creating a circular menu and so far, I can

  • 0

I have been looking at creating a circular menu and so far, I can get the circular positioning working with Javascript but would still be interested in achieving a pure CSS alternative.

In my research I discovered this menu: http://www.cssplay.co.uk/menus/cssplay-round-and-round.html.

So that menu has been done by giving every single list item a class with an index (p1, p2, p3 …) then the sub circles children have the classes (s1, s2, s3…). Then the items are -webkit-transformed into place from their class.

Is there any way to do this without having to hardcode the clases onto the elements and write out the CSS rules for each type? If not, what is the best way to do this with JS?


What I have so far

I have achieved the desired effect by absolutely positioning the elements with Javascript, however I’m not really interested in this style of solution. The code looks like:

var circles = document.getElementsByClassName('circle');
var radius = circles.style.height / 2;

for(var i = 0; i < circles.length; i++) {
    var items = circles.children;
    for(var i = 0; i < items.length) {
        items.style.left = 0 + cos((i / items.length) * 360) * radius;
        items.style.top = 0 + cos((i / items.length) * 360) * radius;
    }
}

The actual code is a bit more complex because of the object nature of the return of style.width, but as an example this should give you the gist of things.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:34:54+00:00Added an answer on June 1, 2026 at 9:34 pm

    You can use the nth-of-type pseudo-class. For example instead of

    ul.circles:hover li.p1 { ... }
    ul.circles:hover li.p2 { ... }
    ul.circles:hover li.p3 { ... }
    ...
    

    You can use

    ul.circles:hover li:nth-of-type(1) { ... }
    ul.circles:hover li:nth-of-type(2) { ... }
    ul.circles:hover li:nth-of-type(3) { ... }
    ...
    

    And thus remove the (p1, p2, p3…) and (s1, s2, s3 …) classes from the HTML.

    Unfortunately, you’re still required to know the number of items in the menu and write out a rule for each item.

    If a more elegant solution was possible in CSS, there would have to be something like display: table-row where the row is wrapped around a circle. You might be able to get part of the way if you could make each li’s transform relative to the previous one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking at creating an augmented reality application. Can anyone suggest a
I have been looking into different systems for creating a fast cache in a
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
I have been looking around ocn Google and Stackoverflow but haven't found what I
I have been looking into the possibility of creating a soft copy(image/EMF file) of
I have been tasked with looking into our deployments, and seeing where they can
I have been looking into creating a custom mySQL Point Of Sales system so
I have been looking into some options for creating a slide out bar for
I have been looking on SO and can't seem to find something more recent
I have been looking into creating a signature on the OAuth site & over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.