SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Centralize div and nested sub div does not work ???

    Hello guys,
    I have a div, which I use as a navigation and want to nest it into a main div, which should centralize 90% of the page.

    However it does not work, this is the main div

    .MainNavigations {
    /**/
    width: 90%;
    margin: 0 auto;
    text-align: center;
    border: solid;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: 14px;



    margin-left: auto ;
    margin-right: auto ;

    }


    please advise

    many thanks
    Ehi

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,372
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Wed need to see the full html and css as the above code only tells us that you have an element set to 90% and then centred with auto margins (assuming that this is a block element).

    If you are nesting this div in another element then we'd need to see the code for that element also.

    Auto margins only horizontally centre block elements (that are not floated) that have a width defined (unless they are display:table).

  3. #3
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply Paul,
    I sorted it out and sorry for not posting the full code, its here

    The left attribute sorted it out

    many thanks

    div.mainmenu {
    /* top: 150px;
    left: 20px;*/
    position:absolute;
    font-weight: bold;
    z-index: 100;
    left: 15%;/*------------15% centralizes the nested div in the above div ------------------*/


    }


Bookmarks

Posting Permissions

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