user1492051
user1492051

Reputation: 906

Align text center and vertically

in bootstrap if i use the class text-center i get something like

                              aaaaaaaa
                            aaaaaaaaaaaa
                               aaaaaa

and if i use text-left i get

aaaaaaaa
aaaaaaaaaaaa
aaaaaa

but what if i wanted the following

                            aaaaaaaa
                            aaaaaaaaaaaa
                            aaaaaa

i am not sure what this is exactly called and how can i achieve it, any ideas?

Upvotes: 1

Views: 56

Answers (1)

royhowie
royhowie

Reputation: 11171

You should use Bootstrap's built-in grid system:

HTML:

<div class="col-lg-6 col-lg-offset-3 text-left">
    <p>aaaaaaa</p>
    <p>aaa</p>
    <p>aaaaaaaaaaa</p>
</div>

This will center the block while keeping the text flushed left to the invisible margin. The basic rule is to use col-lg-X and col-lg-offset-X/2 for your classes; this will ensure the div is centered. You need to manually (or programmatically) type X. Using what I typed obviously won't work.

Upvotes: 1

Related Questions