Center aligning div elements


Well, in most of the scenarios in a web designing art, you might come across one wherein you have to center align a div tag, without affecting the text in it. Your first thought might be text-align:center;

But if you want to center align the div alone, leaving the text alignment to be unaffected, you can use this trick css styling. Just give the margin of the div as : margin:0 auto; Lol… done.

It goes well for all browsers.

Thats all… you can now center align a div without affecting the text-alignment of the div contents.

2 thoughts on “Center aligning div elements

  1. salam. ozr mikham ba oooultk mikhastam emailhamo chek kunam, barha saay kardam, emailhamo ham miare ama akharesh in error ro minevise va minevise contact your isp. error in hast (ox8ooccc0r) ya synchronizing subscribed folder for [email]مرورگر این کاربر سیستم عامل این کاربر

  2. Hi there, rjiang. The Newsletter suiitrspcbon is what gives you access to the Downloads Section. Please check your spam filter for email from . you should have received a confirmation email with your suiitrspcbon and the password is included in that message. I just tested the suiitrspcbon and current password and they appear to be working correctly. Please let me know if your issues persist after receiving the confirmation email. Thank you. The SharePoint Dude.

Feel free to leave a reply here...

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