HTML: Center element horizontally

16 02 2013

Since there is no single element that allows horizontal centering elements (or maybe there is some deprecated one), I post my solution to it.

It is made using CSS, where the style class looks as follows:

.centered {
	width: 200px auto;
	display: block;
	margin-left: auto;
	margin-right: auto;

To center an image on HTML page with centered class do the following:


Did I help you?
I manage this blog and share my knowledge for free sacrificing my time. If you appreciate it and find this information helpful, please consider making a donation in order to keep this page alive and improve quality

Donate Button with Credit Cards

Thank You!



One response

18 02 2013

Give Your feedback:

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

You are commenting using your 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: