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

How to make text allign from the left?

Quick question about CSS. If i have some tags inside an header element, paragraphs h1s list items etc. If i wanted everything inside of that header element to allign from the left, in one long line of text, how would i do that?

2 Answers

Steven Parker
Steven Parker
229,657 Points

This would be one way:

header * { float: left; }

And depending on what the items are, this may even work better:

header * { display: inline; }

If you showed the actual code, it would be easier to give specific answers that would work for it.

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,671 Points

Or this:

header { display: flex; }; // defaults to flex-direction: row;

Flexbox is widely supported now. So, you should be OK using it.

Steven Parker
Steven Parker
229,657 Points

I tried that, but it doesn't flatten out the items in a list like the other methods do.

Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,671 Points

I guess I misunderstood the question! ¯_(ツ)_/¯

Steven Parker
Steven Parker
229,657 Points

Oh, but this does:

header { display: flex; } 
header * { display: flex; }