dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Quick and Simple Nesting Divs for Layout Question

  1. #1
    Join Date
    Dec 2004
    Posts
    439

    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

  2. #2
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746

    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.

  3. #3
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    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?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles