Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / August 2006



Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
laredotornado@zipmail.com - 27 Aug 2006 16:05 GMT
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
Stephen Poley - 27 Aug 2006 16:20 GMT
>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
[quoted text clipped - 4 lines]
>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?

Signature

Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/

Ed Mullen - 27 Aug 2006 16:42 GMT
> Hello,
>
[quoted text clipped - 8 lines]
>
> 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>

Signature

Ed Mullen
http://edmullen.net
http://mozilla.edmullen.net
http://abington.edmullen.net
A cubicle is just a padded cell without a door.

Jeremy - 29 Aug 2006 21:07 GMT
>> Hello,
>>
[quoted text clipped - 14 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.