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 8007979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:59:59+00:00 2026-06-04T17:59:59+00:00

I have to draw 32 rectangles along a circle using html5, css3 and js.

  • 0

I have to draw 32 rectangles along a circle using html5, css3 and js.
You can see my goal with this image:

myGoal
.

My designed solution was to create “a for” in js that would generate 32 rectangles each time increasing rotation, coordinates and z-index. I tried but it is too intricate.

Please help me.

  • 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-04T18:00:01+00:00Added an answer on June 4, 2026 at 6:00 pm

    Here’s a new version, updated to show the OP’s requirement to have an actual DOM element for each rectangle, and not a single canvas:

    var n = 32;
    
    for (var i = 0; i < n; ++i) {
        var d = document.createElement('div');
        var r = 360 * i / n;
        var s = 'translate(200px,200px) rotate(' + r + 'deg) translate(0px, -180px)';
    
        d.setAttribute('class', 'box');
        d.setAttribute('style', '-webkit-transform:' + s);
    
        var t = document.createTextNode(i);
        d.appendChild(t);
    
        document.body.appendChild(d);
    }​
    

    working demo at http://jsfiddle.net/alnitak/CFAyf/ which contains some additional (and necessary) CSS

    NB: you’ll need to use browser detection to set the right -transform style attribute. The sample shown is correct for Chrome and Safari.

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

Sidebar

Related Questions

I have a grid on which users can draw rectangles (actually rooms in a
I have my program that can draw rectangles. I have two problems I can't
I have to draw a bitmap image using DrawingContext.DrawImage method. Using the code below
I have an image that the user can zoom/scroll. I want to draw some
I have been using NSRectFill to draw rectangles on the screen. I would like
I am playing with the HTML5 canvas element, using JS to draw some rectangles
I have a canvas where I can draw, resize and move rectangles around. I'm
I have to draw a circle in live wallpaper when it touches the boundary
I'm drawing rectangles on the screen using the basic NSBezierPath method. I have an
I have succesfully extended a view and overridden the onDraw() method I can draw

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.