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 a Website CSS: Cascading Style Sheets Style the Basic Elements

question

how to align with text using css

3 Answers

Use text-align: [left]-[center]-[right]-[justify] etc..

like this

#myDiv{
text-align:left;
}
Samiruddin Syed
Samiruddin Syed
3,136 Points

Where ever you want to align the text, for example if the id of that particular div is : myDiv, then your CSS will look like :

#myDiv{
text-align:left;

}

Note : The above code aligns the text inside the div to the left. If you want to align to right, then use "right", and "center" for center and "justify" for justifying the text in the div.

Hope that helps.

Patrick Lamb
Patrick Lamb
4,285 Points

You can also align the text vertically with:

vertical-align:top

Or use bottom, middle

You can find more info here: http://www.w3schools.com/cssref/pr_pos_vertical-align.asp