467,885 Members | 1,326 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,885 developers. It's quick & easy.

How can I have only part of a image in the background?

Hello,

I have a cell that is 100 pixels wide and an image that is 200 pixels
wide. I want to put the right-most 100 pixels of that image as my
background image. How can I do taht? If I specify

background-image:url('images/myimg.gif');

by default, the image starts displaying from left to right, so I only
get the left-most 100 pixels, which I don't want.

Thanks for your help, - Dave

Aug 27 '06 #1
  • viewed: 1127
Share:
3 Replies
On 27 Aug 2006 08:05:59 -0700, la***********@zipmail.com wrote:
>I have a cell that is 100 pixels wide and an image that is 200 pixels
wide. I want to put the right-most 100 pixels of that image as my
background image. How can I do taht? If I specify

background-image:url('images/myimg.gif');

by default, the image starts displaying from left to right, so I only
get the left-most 100 pixels, which I don't want.
How about editing the image with something like Irfanview and extracting
the rightmost 100 pixels?

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Aug 27 '06 #2
la***********@zipmail.com wrote:
Hello,

I have a cell that is 100 pixels wide and an image that is 200 pixels
wide. I want to put the right-most 100 pixels of that image as my
background image. How can I do taht? If I specify

background-image:url('images/myimg.gif');

by default, the image starts displaying from left to right, so I only
get the left-most 100 pixels, which I don't want.

Thanks for your help, - Dave
How about positioning? Ala:

<td style="background-image:url('images/myimg.gif');
background-position: -100px 0px; background-repeat: no-repeat;">blah
blah blah</td>

--
Ed Mullen
http://edmullen.net
http://mozilla.edmullen.net
http://abington.edmullen.net
A cubicle is just a padded cell without a door.
Aug 27 '06 #3
Ed Mullen wrote:
la***********@zipmail.com wrote:
>Hello,

I have a cell that is 100 pixels wide and an image that is 200 pixels
wide. I want to put the right-most 100 pixels of that image as my
background image. How can I do taht? If I specify

background-image:url('images/myimg.gif');

by default, the image starts displaying from left to right, so I only
get the left-most 100 pixels, which I don't want.

Thanks for your help, - Dave

How about positioning? Ala:

<td style="background-image:url('images/myimg.gif');
background-position: -100px 0px; background-repeat: no-repeat;">blah
blah blah</td>
I think if you want the rightmost 100 pixels, it would be better to use

background-position: right top;

or to vertically center it,

background-position: right center;

That way, even if the image is not precisely 200 pixels wide, you'll
still get the rightmost 100 pixels.

Jeremy
Aug 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Susan | last post: by
5 posts views Thread by Mark | last post: by
reply views Thread by ameshkin | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.