...

View Full Version : Unable to center <DIV> layout



amb
05-08-2011, 10:56 PM
Hi guys

I'm trying to center a authorize.net logo which is placed in the lower left corner of this site: store.ambu.com/am_esa/esa/

I'm using these CSS parameters, but it will just not move out of the spot!

div.AuthorizeNetSeal {
color: #BEBEBE;
font-family: Trebuchet MS,Helvetica,Verdana,Arial,sans-serif;
font-size: 12px;
line-height: 12px;
padding-left: 3px;
position: absolute;
text-align: center;

Any ideas are very much appreciated! :confused:

Thank's

Regards
Allan

DanInMa
05-08-2011, 11:57 PM
well you got some very serious validation errors going on from the get-go. your doctype isn't declared correctly, you dont have an opening <html> tag, etc. <style> blocks in the middle of the page, <script> blocks with ID's assigned....., 59 http requests on page load! you've got like 13! style sheets, inline styles and style blocks in weird places, your even calling some external scripts more than once. yikes. Last thing you need to worry about is centering an image. It probably wont center because the browser has no idea what your trying to do so It's just deciding for itself.


- see here on the online validator- http://validator.w3.org/check?uri=http%3A%2F%2Fstore.ambu.com%2Fam_esa%2Fesa%2FHome.jsp%3Fmainpage%3DHome.jsp&charset=%28detect+automatically%29&doctype=Inline&group=0

mahesh2010
05-09-2011, 07:18 AM
<div style="margin: 0 auto;">your content</div>

This will give you a 0 margin on the top and bottom, and automatic equal margins on the left and right.You try this.It may help to solve you problem

AndrewCollins
07-30-2011, 08:10 PM
<div style="margin: 0 auto;">your content</div>

This will give you a 0 margin on the top and bottom, and automatic equal margins on the left and right.You try this.It may help to solve you problem

I just tried this but it messes up my layout. Am I doing something wrong?

vikram1vicky
07-30-2011, 08:31 PM
Remove position:absolute property and add following code to your DIV



.your_DIV {
margin:0 auto;
width:960px; /*You have to define width to make your DIV centralized because we can make anything element centralized only if it's width is lesser than its parent element. */
/* --------rest of your code-----*/


Let me know if it helped you :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum