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

Since HTML5 does not support the <center> tag anymore, should I include it in the style?

"text-align:center" or "margin: 0 auto" for example. Or you guys may have a more specific suggestion for email design?

Yes, include it in your css markup and avoid html styling.

It's best practice to format your content in the CSS. There are several methods in CSS to center your content depending on what you want to center. Yes, 'text-align:center' and 'margin:auto' are two methods you could use. However, 'margin: auto' isn't going to center align your text. 'margin:auto' is used to center sections.

Thank you Marc and Joseph. I think I know what to do now:)

You're welcome, Thi Mai Huong Do! Good luck and have fun learning!

1 Answer

Steven Parker
Steven Parker
243,318 Points

:point_right: You should use styles instead of the <center> element tag.

"text-align: center" or "margin: 0 auto" are good, depending on whether you are centering text or block elements, plus there are several other options to choose from (like flexbox, for example) that can provide centering.