Jump to content

Centering


James_Parsons
 Share

Recommended Posts

create a class such as

.textCenter {text-align: center;}

then wrap the <p> in a <div> and give the div that class.

<div class="textCenter"><p>Hello</p></div>

Now with that all you have done is centered the <p> inside the <div>, not the document so now we need to center the div.

.divCenter {margin: 0 auto;}

Now apply it to the div.

<div class="divCenter textCenter"><p>Hello</p></div>

All done. Now it may seem like allot, but once you add allot more content you will see how convenient this is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...