Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Div within Div not centering Firefox and I'm using margin: 0 auto
Old 05-26-2008, 01:21 PM Div within Div not centering Firefox and I'm using margin: 0 auto
Novice Talker

Posts: 9
Trades: 0
Hi there. Ran into this issue with centering a div within a wrapper div. The child div is not centering in relation to the parent div in Firefox 2.

My Google searches on this problem have revealed solutions that look similar to this:

Code:
div#wrapperdiv {
   text-align: center;
}


div#div_to_be_centered {
   text-align: left;
   margin: 0 auto;
   width: 650px;
}
Now when I apply this idea to my own site I am not getting the desired effect. IE7 is centering the child since I think it is reacting to the text-align: center; code in the parent div. But FF is not centering the inner div. Here is my code:

Code:
.outer-div {
    width: 558px;
    background-color:#9999FF;
    text-align: center;
}

.inner-div {
    margin 0 auto 0 auto;
    width: 380px;
    background-color: #009900;
    border-color: #00ff00;
    border: 2px solid;
    font-family:Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #00ff00;
    padding: 40 0 20 0;
}
I'm stumped, but thinking it may have to do with my outer-div being further wrapped inside a floating div, which is inside an even larger div.. Can this nesting of divs be the issue?
labiere is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-26-2008, 01:45 PM Re: Div within Div not centering Firefox and I'm using margin: 0 auto
Novice Talker

Posts: 9
Trades: 0
Here is a live example of it:

http://public.zeidelicious.com/stakes.html

The green box in the right column is the problem div.
labiere is offline
Reply With Quote
View Public Profile
 
Old 05-26-2008, 02:06 PM Re: Div within Div not centering Firefox and I'm using margin: 0 auto
Novice Talker

Posts: 9
Trades: 0
Syntax error. Colon missing in the margin value.
labiere is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Div within Div not centering Firefox and I'm using margin: 0 auto
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.56450 seconds with 12 queries