how to make 16:9 Div?

Discussion in 'Web Design and Development' started by timmillwood, Mar 6, 2007.

  1. timmillwood macrumors 6502a

    Joined:
    Apr 7, 2006
    #1
    I want to make a website which has a div container that is 16:9 format. That bit is easy, but i want it to change size to fit different screen resolutions while still keeping the 16:9 format.

    anyone know how to do it?
     
  2. Nermal Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    New Zealand
    #2
    I'm not sure what you're actually asking. You can specify the width of various elements, but the height usually scales to fit the content. Don't assume that the content will always fit in the same amount of space; the user's available fonts or settings can change the amount of text that fits in a particular area.
     
  3. tominated macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #3
    width = 80%
    height = 45%

    or in css

    Code:
    .id-of-a-div {
        width: 80%;
        height: 45%;
    }
     
  4. timmillwood thread starter macrumors 6502a

    Joined:
    Apr 7, 2006
    #4
    yeh thats the idea i had but i set the height and it only goes as big as the content and not the size in the css
     
  5. Sdashiki macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #5
    you need to put that div inside of a wrapper/container div of the right size...
     
  6. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #6
    How big is the div?

    The CSS of height and width are relative to the page. So it'll keep the 16:9 aspect, but you need to put in a baseline value for those values.

    Another way you can do it is having it's height and width, while at the ratio, be inherit of the page. This is where I find Dreamweaver useful. I can modify the CSS file and test in the browser in less than minute.

    Steve
     

Share This Page