SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Guru quenting's Avatar
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    percentage of container ?

    is there a way to set a div's width to some percentage of it's container, or can the % only be applied to the whole page width ?

    Thanks
    Quentin

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    If you have a <div> within another container <div>, any percentage you give it will be in proportion to the container. For example, if your container is 80% wide and your inner <div> is also 80% wide, the inner <div> will only be 64% of the window's size.

    --Vinnie

  3. #3
    SitePoint Guru quenting's Avatar
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    oops

    my mistake :-p.
    Made some wrong code that made me think it, but obviously you're right.
    Thanks anyway
    Quentin

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    No problem!

  5. #5
    killall -9 lusers
    Join Date
    Oct 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am certain that I remember that one of the browsers (can't remember if it's Netscape or IE) doesn't calculate this properly (% of container) but rather calculates _any_ percentage width relative to the browser window. Can anyone concur?

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by KillAllDash9
    I am certain that I remember that one of the browsers (can't remember if it's Netscape or IE) doesn't calculate this properly (% of container) but rather calculates _any_ percentage width relative to the browser window. Can anyone concur?
    Yeah, NS4 did that. Throw it to the trash heap!


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
  •