Bummer! You must be logged in to access this page.

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

HTML

I need help with html code!

Hi there i posted earlier but it didnt work. How do i have text and center it. I looked it up and found something but then it would resize when the screen size changes. here is my code: http://codepen.io/anon/pen/YXBYZN

2 Answers

<a> elements without the href are not valid. I'm not sure if you want the text to be an anchor or not. Also, anchor tags are inline by default, so text-align doesn't work because you're center aligning the text in a box only as long as the text itself is. If you don't need the text anchors, than change the <a> elements to a <div> which is a block level element by default, and than your text-align: center will work. Or fix your anchor tags, and use margin: 0 auto to align the anchor tag element in the middle of a block level parent element, like a div.

Hi Aaron, it depends on where you want to center text and how. In your particular pen, just change your first a tag to a div. This solves the problem because the div is a block level element by default, whereas the a tag is inline.

oh i see what i was doing wrong. thanks soo much! I need to create a div element which uses the class "header" to position, then then a nested div with the class "cursive" to style that word, close the second div, add spaces, add next word then close first div.