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
Anita Amini
6,389 PointsCentering content in CSS
Hi guys,
I was wondering if someone could help me with my code. I'm trying to put names inside circles but I can't make the text vertically centered.
the html:
<ul>
<li class="name_1">Name 1</li>
<li class="name_2">Name 2</li>
<li class="name_3">Name 3</li>
</ul>
the css:
li { list-style-type: none; list-style-type: inline-block; display: inline; padding: 30px; margin-left: 10px; margin-right: 10px; }
.name_1, .nam_2, .name_3 { font-size: 2.2rem; background-color: #dee2de; color: #3a3a3a; border-radius: 50%; text-align: center; width: 200px; height: 200px; display: inline-block; }
Thanks.
2 Answers
Raúl Barrera C.
18,943 PointsTry adding line-height equal to height valor
.name_1, .name_2, .name_3 { ... line-height: 200px; }
Anita Amini
6,389 Pointsomg I feel so stupid now. Thank you :)
Raúl Barrera C.
18,943 Points:D