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
38,983 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