Jump to content

CSS and Images

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Chan

Chan

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 204 posts
With CSS you can repeat an image by using "repeat x" or "repeat y" so.. how do I stretch an image??? :confused:

#2
brendan

brendan

    Newbie

  • Members
  • PipPip
  • 15 posts
i'm not sure why you would want to, unless i'm not understanding you.. But you can resize image height and width like this:

<img src="image.gif" height="xxx" width="xxx" />

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I think he means "stretch" as in stretch the image to fit the current spot whether it is too small or too large, correct?

#4
Jimbo

Jimbo

    Programmer

  • Members
  • PipPipPipPip
  • 121 posts
Exactly as brendan said, increase the image dimensions to whatever you want in the IMG tag, or set its height/width to 100% and change the size of the container

#5
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
If he only used height and width it would not stretch though. I think what you are looking for is:

 <div style="width: 100%; height: 100%; left: 0px; top: 0px; position: absolute; z-index: 0;"> 
<img src="image.gif">
</div>


#6
Jimbo

Jimbo

    Programmer

  • Members
  • PipPipPipPip
  • 121 posts

Lop said:

If he only used height and width it would not stretch though. I think what you are looking for is:


 <div style="width: 100%; height: 100%; left: 0px; top: 0px; position: absolute; z-index: 0;"> 

<img src="image.gif">

</div>


That wouldnt work, if you dont explicitly set the dimensions of the image it will default to its normal size, to stretch an image you set the width and height attributes in the IMG tag to the desired size, either px or %