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 8654903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:54:02+00:00 2026-06-12T14:54:02+00:00

How to target a specific location on the image to be cropped using css

  • 0

How to target a specific location on the image to be cropped using css or javascript, simple way without big scripts,

Picture before :
enter image description here

I want the highlighted location on the following image to be viewed :

enter image description here

Not the exact highlighted though, just trying to explain it doesnt has to be from the very top, i want to select specific image scales,
AND how to resize is after cropping ?

  • 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-06-12T14:54:03+00:00Added an answer on June 12, 2026 at 2:54 pm

    Update 2022-05-27: A new property object-view-box will soon make this a lot simpler: https://ishadeed.com/article/css-object-view-box/


    One approach is to use an element with overflow: hidden that has the image as a child, which itself is absolutely positioned within the context of the original element. The result being, the size of the overflow: hidden element masks the image.

    Here’s an example of the approach:

    HTML

    <div id='crop-the-cats'>
        <img src='https://i.stack.imgur.com/ArS4Q.jpg'>
    </div>​
    

    CSS

    #crop-the-cats {
        width: 100px;
        height: 80px;
        overflow:hidden;   
        position:relative;
    }
    
    #crop-the-cats img {
        position: absolute;
        top: -60px;
        left: -70px;
    }
    

    ​See http://jsfiddle.net/Da9CT/

    Another approach is to use the image as the background of the image and reposition it using background-position:

    HTML

    <div id='crop-the-cats'></div>​
    

    CSS

    #crop-the-cats {
        width: 100px;
        height: 80px;
        background-image: url(https://i.stack.imgur.com/ArS4Q.jpg);
        background-position: -50px -60px;
    }
    

    ​See http://jsfiddle.net/Da9CT/2/

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

Sidebar

Related Questions

I'm experienced in using media queries to target CSS to specific browser sizes/or contexts,
I plan to build a websites that come to target specific countries and each
I know in Visual Studio 2008 you can target a specific framework with your
I am developing a silverlight application where you can set sales target for specific
How to get rid of extended $.extend() function from a specific target object .
So sometimes (oftentimes!) you want to target a specific .NET version (say 3.0), but
I'm playing with Behat and Selenium server. I'm trying to target a specific tag
I want do compile all *.less scripts in a specific folder and it subdirs
I need to take standard incoming urls and rewrite redirect them to target specific
How do you call a specific target in all build.xml located in all subdirectories

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.