Quick and Simple Nesting Divs for Layout Question
Hello. Im getting good at usiing divs for layouts, I just have a quick question:
When nesting a div within a div, should i alot for a pixel in my widths? say for instance i have a div that is 200px wide, then i want to nest a div inside that, should i make that width 198px?
I assume that other things like setting margin and borders apply, im just wondering about general rules to follow, thanks
never heard that asked before...
Great question, though!
I would say that if the nested DIV had a border of say, 1px and margin:0;, then yes, it should be two pixels less-wide than the containing DIV (to allot for the left and the right and we assume here that the height is much less than the height of the container DIV).
I have never encountered this occurance...it will be interesting to see what others have to add. I wonder though, -what if the nested div were wider than the container div BUT it was z-index:2 (one higher than container)? Then, would that not matter, or would it compromise the container div anyway?
Last edited by WebJoel; 04-13-2006 at 07:57 PM.
As long as the inner div is unadorned it should fit with the same dimensions. We are talking about web browsers here and not IE, right?
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)