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 trialElena Paraschiv
9,938 Pointsmake more circles inside a bigger circle
Dear all,
Now it looks like this eggs And I would like to repeat the white circles inside the red shapes. Do you guys have any idea?
.egg{
display:inline-block;
width:200px;
height:200px;
background:#ff8080;
border-radius:100% 50%;
margin: 10px 40px;
position:relative;
}
.egg::after{
width:20px;
height:20px;
position:absolute;
content:"";
background:#fff;
top:50px;
left:50px;
border-radius:100%;
}
<div class="egg"></div>
<div class="egg"></div>
<div class="egg"></div>
<div class="egg"></div>
2 Answers
Steven Parker
231,269 PointsYou could get a second one using ::before, like this:
.egg::before{
width: 20px;
height: 20px;
position: absolute;
content: "";
background: #fff;
top: 130px;
left: 130px;
border-radius: 50%;
}
But if you want more than two, I think you'd need to add additional elements inside the egg DIV's. Using the same concept, each additional element could potentially add 3 more shapes.
Elena Paraschiv
9,938 Pointsthanks Steve! That looks fun and its good practice of the selectors
Elena Paraschiv
9,938 PointsElena Paraschiv
9,938 PointsAwesome! Thanks Steven!
Steven Parker
231,269 PointsSteven Parker
231,269 PointsHappy to help, Elena. I had some more time today so just for fun, I tried my own suggestion (and I condensed the CSS a bit):
Happy coding!