Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    amb
    amb is offline
    New to the CF scene
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Unable to center <DIV> layout

    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!

    Thank's

    Regards
    Allan

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    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=ht...Inline&group=0
    Last edited by DanInMa; 05-08-2011 at 11:59 PM.

  • #3
    New Coder
    Join Date
    Jun 2010
    Location
    usa
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unable to center <DIV> layout

    <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

  • #4
    New Coder
    Join Date
    Jul 2011
    Location
    Berkeley, CA
    Posts
    20
    Thanks
    2
    Thanked 2 Times in 1 Post
    Quote Originally Posted by mahesh2010 View Post
    <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?

  • #5
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Remove position:absolute property and add following code to your DIV

    Code:
    .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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •