Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops The Refactor Challenge, Part 2

div circles..how?

I've seen a lot of people mention problems with how circles are created from div tags. I think Dave should mention there is a css style sheet being used in conjunction with the script to produce the circles for the div tag. This should have been introduced if css was going to be used.

1 Answer

Greg Kaleka
Greg Kaleka
39,021 Points

Hey Ronald,

You can turn squares into circles by setting the css border-radius to 50%. If the corners are each rounded halfway, it turns into a circle.

The css in the workspace includes this rule:

#color div {
  width: 50px;
  height: 50px;
  display: inline-block;
  border-radius: 50%;  /* This makes it a circle */
  margin: 5px;
}

Cheers :beers:

-Greg