Ray
Ray

Reputation: 6105

div centering techniques / question

I've got a div with a background color blue, that needs to be centered in another div with background green -- just for looks. I centered the blue div inside the green div with a "margin: 10px auto". Now, I need the text inside this blue div to be left justified, not centered, so I put the text inside a div and gave it a margin of zero. That didn't work.

Obviously I'm confused about centering things in general, and am still coming up the css centering / positioning learning curve. Any thoughts / comments appreciated. Thanks.

Upvotes: 0

Views: 80

Answers (1)

Cata
Cata

Reputation: 498

You need to place a:

text-align: left

style on the DIV containing the text.

margin: auto only works for centering DIVS, has no effect on actual text

Upvotes: 2

Related Questions