CSS Center Multiline Text, with all beginning on the same vertical line

I find all kinds of examples centering text, but I can't seem to figure out how to center mulitline text like this:

                 This is the first line
                 This is the second line

Both lines begin at the same point. This might be an easy one, but I'm stuck.
madorianAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
How is your example centered?
Dan CraciunIT ConsultantCommented:
That's not centered, that's left aligned with a margin. It's on the Page layout tab.
Paragraph->Indentation->Left, and there put the margin you want.

HTH,
Dan
madorianAuthor Commented:
If I use a margin,  then if I add more text to one of the lines, it wont adjust and recenter. Actually, it should center based on the longest line, while at the same time making sure that all lines start at the same position. A bit hard to explain;)
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Julian HansenCommented:
Sorry have no idea what you mean - text is centered or it is left / right aligned or justified.

Not sure what you are asking for.
Dan CraciunIT ConsultantCommented:
So... let's use a drawing:

centered:
___|||||||___
_____|||_____

left aligned:
__|||||||__
__|||______

right aligned:
__|||||||__
______|||__

Open in new window

Which of these do you want?
GreggCommented:
Are you asking how to center a div within a div where the content is left aligned?

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - +
|        + - - - - - - - - - - - - - - - - - +          |             
|        | This is the first line            |          |
|        | This is the next line             |          |
|        + - - - - - - - - - - - - - - - - - +          |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - +

Open in new window

madorianAuthor Commented:
gregg_s; yes, exactly;)
Dan CraciunIT ConsultantCommented:
In Word, use a text box. Put it wherever you want on the page, and use left aligned text in it.

@greg: great mind reading!
Julian HansenCommented:
@gregg_s - nice catch.

So you want the box to always be the width of the longest line?
Something like this
    <div style="position: relative; text-align: center;">
      <div style="display: inline-block; border: 1px solid blue; text-align: left; padding: 20px;">
        <p>This is the longest line in this block</p>
        <p>A short line.</p>
        <p>An even shorter line ...?</p>
      </div>
    </div>

Open in new window

Working sample here

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
madorianAuthor Commented:
Yes, exactly;) Thanks and sorry for the delay accepting the solution.
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.