Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,187 members, 7,818,599 topics. Date: Sunday, 05 May 2024 at 07:36 PM

Whats Wrong With My Containing Div - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Whats Wrong With My Containing Div (885 Views)

Importance Of Div Tags / How To Do Vertical Alignment With Div-based Layouts / Enough Of Table Based Layouts: Time To Migrate To Css-div Layouts (2) (3) (4)

(1) (Reply) (Go Down)

Whats Wrong With My Containing Div by feelme3(m): 3:17am On Jun 13, 2011
Hello people,
Can somebody please take a look at this page. Am trying to have this 2 floated divs in a containg div. I want the containing div to have white BG while d nested divs are transparent. But somehow d nested divs floats just fine without the containing div "containing" them. I don't know where am getting it wrong but I know am missing some. can somebody help me figure it out please??

Heres's my HTML
<div id="frame">
<div id="sidecol">
<ul>
<li>The Foundation</li>
        <li>Mission</li>
        <li>Inspiration</li>
        <li><a href="#">Management</a></li>
</ul></div>
<div id="main">
,
</div>
</div>

the CSS
#frame
{
background:#000;
font: 11px/1.5 Arial, Helvetica, sans-serif;
width: inherit;
}


#sidecol {width: 150px;
margin-right:15px;
height:auto;
float:left;
}

#sidecol ul {color:#f60;
                 list-style: none;
                 line-height:3em;
                 text-indent:-2em;
                 margin-top:0;
                 }

#main {width: 600px;
border-left: 1px solid #999;
float: left;
background:#fff;
}

You can preview it here  http://on.nigautoguide.com/about.html
Re: Whats Wrong With My Containing Div by Nobody: 7:55am On Jun 13, 2011
Caramba! someone please help this guy. . .
Re: Whats Wrong With My Containing Div by feelme3(m): 8:43am On Jun 13, 2011
*dhtml:

Caramba! someone please help this guy. . .

dhtml, no be like wia person see christ e come refer am to hospital? Abeg, oga mi, at thy word I know say d proble go fix itsef, abeg. wetin dey wori me or the code? I wan dey like u wen I grow up.
Re: Whats Wrong With My Containing Div by DualCore1: 9:33am On Jun 13, 2011
HTML

<div id="frame">
<div id="sidecol">
<ul>
<li>The Foundation</li>
<li>Mission</li>
<li>Inspiration</li>
<li><a href="#">Management</a></li>
</ul></div>
<div id="main">
,
</div>
<div class="clear"></div>
</div>



CSS


.clear{
clear:both;
}


#frame
{
background:#000;
font: 11px/1.5 Arial, Helvetica, sans-serif;
width: inherit;
}


#sidecol {width: 150px;
margin-right:15px;
height:auto;
float:left;
}

#sidecol ul {color:#f60;
list-style: none;
line-height:3em;
text-indent:-2em;
margin-top:0;
}

#main {width: 600px;
border-left: 1px solid #999;
float: left;
background:#fff;

}
Re: Whats Wrong With My Containing Div by DualCore1: 9:36am On Jun 13, 2011
another solution.

No changes to your original HTML in your first post, just the CSS. Look at the change in bold.



CSS
#frame   
      {
      background:#000;
      font: 11px/1.5 Arial, Helvetica, sans-serif;
      width: inherit;
      }


#sidecol   {width: 150px;
      margin-right:15px;
      height:auto;
      float:left;
      }

#sidecol ul {color:#f60;
                 list-style: none;
                 line-height:3em;
                 text-indent:-2em;
                 margin-top:0;
                 }         

#main   {width: 600px;
      border-left: 1px solid #999;
      float: left;
clear:right;
      background:#fff;

      }
Re: Whats Wrong With My Containing Div by iwantto(m): 9:37am On Jun 13, 2011
The containing DIV has not height parameter set. You will need to set the height to auto and an Overflow to hidden. Your #frame should look like this:

#frame    
     {
     background:#000;
     font: 11px/1.5 Arial, Helvetica, sans-serif;
     width: inherit;
     height: auto;
     overflow: hidden;
     }


Also note, when you are floating a div, you should also clear the float, else the entire placement of elements will be distorted by the float.

Hope this help?
Re: Whats Wrong With My Containing Div by feelme3(m): 9:45am On Jun 13, 2011
Naija, great nation, wooonderful people.

@Dual, I_want_to, you've giving me a headstart for the week. Thanks so much. Ok, i tried adding padding to the containin div and it ovaflows. How do i fix that? Actually, am trying to model my page exactly after this one
http://www.skollfoundation.org/about/mission/
Re: Whats Wrong With My Containing Div by iwantto(m): 4:11pm On Jun 13, 2011
To achieve the page structure as skollfoundation.org, you will need to have a measured div elements.

The main containing DIV must have a defined width. Every other elements should also have their width defined. Note that adding a padding to the element increases its height and width measurement.
Re: Whats Wrong With My Containing Div by feelme3(m): 9:11pm On Jun 13, 2011
Ok. Thanks. So far am getting better result with your advice. But, I notice IE doesn't display the shadow effect whereas it comes out cool in chrome and FF. Any idea why that is?

Here's what I have used

.shadow {
-moz-box-shadow: 5px 5px 5px #ccc;
-webkit-box-shadow: 5px 5px 5px #ccc;
box-shadow: 5px 5px 5px #ccc;
}
Re: Whats Wrong With My Containing Div by yawatide(f): 1:26am On Jun 14, 2011
Your above code won't work in IE because:

1) Anything less than IE8 does not support CSS3, and
2) IE9 is barely scratching the surface, with respect to supporting CSS3

So what can you do?
1) Either practice "graceful degradation" where the page looks good in all compliant browsers but looks "the normal way" in non-compliant browsers, OR

2) You add an IE-specific rule to your rule above like so:
FILTER: DropShadow(Color=#0066cc, OffX=5, OffY=-3, Positive=1);

good luck!
Re: Whats Wrong With My Containing Div by feelme3(m): 8:59pm On Jun 15, 2011
yawa-ti-de:

Your above code won't work in IE because:

1) Anything less than IE8 does not support CSS3, and
2) IE9 is barely scratching the surface, with respect to supporting CSS3

So what can you do?
1) Either practice "graceful degradation" where the page looks good in all compliant browsers but looks "the normal way" in non-compliant browsers, OR

2) You add an IE-specific rule to your rule above like so:
FILTER: DropShadow(Color=#0066cc, OffX=5, OffY=-3, Positive=1);

good luck!

I applied the above code and removed it as fast as I put it. I guess my luck didnt work.
But again, I've tried looking through the source code of the page http://www.skollfoundation.org/about/mission/ which is what am trying to model but I got dizzy from the page and couldn't figure where the shadow effect was applied. Now I wonder how they achieve the "imageless" shadow effect for IE.

(1) (Reply)

The Server Hosting My Site Has Been Down Pls Help !!! / Online marketers and advertisers, please help review (PhoneNumberExtractor.com) / Somali, Zulu, Hausa, Yoruba And Igbo To Google Translate

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 28
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.