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

CSS

CSS 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, Would really need to see your html as well to best troubleshoot your issue

I think I erased my work space. I am trying to see if I can recover it.

2 Answers

Steven Parker
Steven Parker
229,644 Points

Without 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.

Thanks 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.