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
Roland O'Donnell
5,667 Pointsi have some text that i want to apply a border, this the class i made .example span{ color: black border: so
i have some text that i want to apply a border, this the class i made CSS
.description span{ color: #000000; border-radius: 100px; border: solid black 3px; text-align: center; }
HTML
<p class="description"> <span> and here is a short description about my new page </span> </p>
not sure if the span is the right thing to be doing? i just want the border to wrap around the text only not the length of the entire screen. only problem is now the text can't be centre aligned? well it doesn't work now. please help I'm just a beginner
3 Answers
Joe Consterdine
13,965 PointsHis CSS is targeting the span Adam.
Roland the text inside the span doesn't center because spans are inline elements. Inline elements don't have space either side and so there's nothing to center. It's the full width of it's container by default.
I'm not sure what you're asking but if you put 'text-align: center' on the .description class instead of the span class this will center the span tag within that p tag.
Joe
Redweb FED
15,517 PointsBecause the text is in the span your css isn't targeting it.
You can either remove the span or create a new css rule that center the text in the span.
Hope this helps
Roland O'Donnell
5,667 Pointsthanks joe.. i just wasn't comprehending the fact that .description span{} only applies to whats inside the span.
.description span{ color: #000000; border-radius: 100px; border: solid black 3px; }
.description { text-align: center; }
thank you for your answers!