Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Proportional Images

    I have an image in a <div>. The <div> has a fixed height and width. I want the image to expand to fill the entire width of the parent <div>, with its height adjusting proportionally. There are many different images which may be used, so I cannot calculate the proportions beforehand. [How] can I do this with CSS?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Code:
    <img src="path" height="100%" width="100%"/>
    ??
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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