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 trialLakesha Barrett-Jones
1,837 PointsCSS Class Style specific element
I am trying to center the title, but it is still aligned to the left. What am I doing wrong?
}
.card-title {
text-align: center;
}
Lakesha Barrett-Jones
1,837 PointsI think I erased my work space. I am trying to see if I can recover it.
2 Answers
Steven Parker
231,269 PointsWithout seeing the code, I'd guess that the element with the class "card-title" has a flow display style (not "block"), or is width-constrained to fit the contents closely.
For center alignment to work, the element must be wider than the contents, and either centered itself, or span the entire document width.
Lakesha Barrett-Jones
1,837 PointsThanks Seth and Stephen. I had to start over, because I accidentally erased my work by starting a new work space. I will let you guys know how it works out when I get back to this spot. Thanks for your help.
seth aruby
10,111 Pointsseth aruby
10,111 PointsLakesha, Would really need to see your html as well to best troubleshoot your issue