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 trialElina Zois
Courses Plus Student 946 PointsText-align seems to only be working within #gallery li element selection, but not in #gallery li a p - why is that?
I tried to align the image caption in the center, and that only work when the syntax was entered within the #gallery li element selection. When it was added in #gallery li a p selection it did not take effect and the text remained on the left.
1 Answer
David Schriever
1,777 PointsThis is simply an asssumption, but I assume this is because of the type of element you are trying to align. The list element is a block element and the a+p elements are inline elements. I assume that it does align it center, but compaired to the a element, which is also an inline element. meaning it has no padding and margin, therefore it aligns it center to nothing, maybe I am wrong.
What happens if you align the <a> element to center? Does that work? Would be interesting to find out ;-)
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Elina,
Can you show both versions of the css that you tried?