![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Please look at: https://testbed.odysseyshipping.com See the large graphic? It's contained within a DIV. I don't want to set fixed width/height using HTML. I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. Can this be done with CSS or do I have to go to JavaScript? |
#3
| |||
| |||
|
|
On 2008-12-10, donpro <donpro-2003 (AT) rogers (DOT) com> wrote: Please look at: https://testbed.odysseyshipping.com See the large graphic? It's contained within a DIV. I don't want to set fixed width/height using HTML. I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. Can this be done with CSS or do I have to go to JavaScript? You can set its width and height as percentages. |
#4
| |||
| |||
|
|
On 2008-12-10, donpro <donpro-2003 (AT) rogers (DOT) com> wrote: Please look at: https://testbed.odysseyshipping.com See the large graphic? It's contained within a DIV. I don't want to set fixed width/height using HTML. I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. Can this be done with CSS or do I have to go to JavaScript? You can set its width and height as percentages. |
#5
| |||
| |||
|
|
On 2008-12-11, Ben C wrote: On 2008-12-10, donpro <donpro-2003 (AT) rogers (DOT) com> wrote: Please look at: https://testbed.odysseyshipping.com I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. You can set its width and height as percentages. Setting both is problematic. How do you maintain the correct aspect ratio? |
#6
| |||
| |||
|
|
Chris F.A. Johnson wrote: On 2008-12-11, Ben C wrote: On 2008-12-10, donpro <donpro-2003 (AT) rogers (DOT) com> wrote: Please look at: https://testbed.odysseyshipping.com I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. You can set its width and height as percentages. Setting both is problematic. How do you maintain the correct aspect ratio? img {width:100%; height:auto;} |
#7
| |||
| |||
|
|
On 2008-12-11, Bergamot wrote: Chris F.A. Johnson wrote: On 2008-12-11, Ben C wrote: On 2008-12-10, donpro <donpro-2003 (AT) rogers (DOT) com> wrote: Please look at: https://testbed.odysseyshipping.com I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. You can set its width and height as percentages. Setting both is problematic. How do you maintain the correct aspect ratio? img {width:100%; height:auto;} Which is not setting both as percentages (which is what I was commenting on). |
#8
| |||
| |||
|
|
Chris F.A. Johnson wrote: On 2008-12-11, Bergamot wrote: Chris F.A. Johnson wrote: On 2008-12-11, Ben C wrote: On 2008-12-10, donpro <donpro-2003 (AT) rogers (DOT) com> wrote: Please look at: https://testbed.odysseyshipping.com I'd rather that the image just expand or contract (in this case, the latter) to fill the DIV without creating a horizontal scroll bar. You can set its width and height as percentages. Setting both is problematic. How do you maintain the correct aspect ratio? img {width:100%; height:auto;} Which is not setting both as percentages (which is what I was commenting on). You should *not* set both, unless you don't care about distortion, or the container is already proportionate to the image dimensions, but that's unlikely. |
![]() |
| Thread Tools | |
| Display Modes | |
| |