Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3216436
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:17:39+00:00 2026-05-17T15:17:39+00:00

background-position: -200px 0; one site says it crops an image from the bottom and

  • 0

background-position: -200px 0;

one site says it crops an image from the bottom and displays the rest part
..another site is saying its shifting the image to the left..what exactly does it do ?

I am trying to implement CSS Sprites..having problem due to this positioning thingy…this is what I have implemented so far…its not working right..I have few links and I want a diff part of the image to be displayed when mouse is moved over a particular link…I am geting output as the whole image being displayed..it wont even crop it..I tried so many things like changing positioning, adding divs..what not..now I am so lost , I dont even know where I began..Could someone plz point out what am I doing wrong here ? Why is the image not getting cropped..sure something is wrong with this positioning X,Y values….
here’s the code:-

<style type="text/css">
#sprite ul{background:url(images/image.jpg) no-repeat;
width:728px;height:1225px;display:block}

#ID1{background-position:0 -1000px}
#ID1:hover{background-position:0 -1000px}

#ID2{background-position:0 -1000px}
#ID2:hover{background-position:0-800px}

#ID3{background-position:0 1000px}
#ID3:hover{background-position:0 -600px}

#ID4{background-position:0 1000px}
#ID4:hover{background-position:0 -400px}

#ID5{background-position:0 1000px}
#ID5:hover{background-position:0 -200px}

#ID6{background-position:0 1000px}
#ID6:hover{background-position:0 -200px}
</style>

HTML:-

<div id="sprite">
<ul>
    <li><a href="#" id="ID1">link1</a></li>
    <li><a href="#" id="ID2">link2</a></li>
    <li><a href="#" id="ID3">link3</a></li>
    <li><a href="#" id="ID4">link4</a></li>
    <li><a href="#" id="ID5">link5</a></li>
    <li><a href="#" id="ID6">link6</a></li>
</ul>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:17:40+00:00Added an answer on May 17, 2026 at 3:17 pm

    background-position: -157px 0; will shift the image 157 pixels to the left. It will not be cropped.

    The main problem from your code is that you are setting the background image on the ul, but then changing the background position on the links. So your background position rules will have no effect as the links don’t have a background. You want to instead set the same background image on all of the links, probably with something like:

    #sprite ul a {
        background-image: url(images/image.jpg);
        background-repeat: no-repeat;
    }
    

    along with some appropriate dimensions, and then take it from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Without using percentages, is it possible to position a background image 2px from the
How do I use the CSS background-position property to center a background image to
I'm using this code to center/position a fixed width image as my background. I
I would like my background image to go from 100% opacity to 0% opacity.
Is it possible to position one element relative to another specific element using only
I have a master page with one div Header. #header { background-image: url(images/ST_ERP_2.jpg); background-repeat:
This is borrowed from another question I made on the site, but would have
I've got a class: .sample { background:url(../sample.png) repeat-x scroll 0 0 transparent; height:200px; position:absolute;
string in question: '{images:{0:<div style=\\background:red;width:250px;height:250px;display:block;position:absolute;\\></div>}}' I've tried various combinations of single and double quotes.
I have this JSF page: <div id=settingsdiv style=width:350px; height:400px; position:absolute; background-color:r; top:20px; left:1px> <h:form>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.