Skip to content

Aligning Center

April 10, 2013

A key useful tip when centering text on a webpage other than using text-align:center is to use margins.

In order for margin: 0 auto; to work, in addition to display:block a width needs to be specified.

You can also specify using margin-left:auto;margin-right:auto;– However you also need to set a width for this.

Also a key thing I found when floating items like text to the right is to use float:right; position:relative;

(But you must set to position relative!)

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: