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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:53:27+00:00 2026-06-05T19:53:27+00:00

Use Case Show a photo uploaded by the user in a square box with

  • 0

Use Case

Show a photo uploaded by the user in a square box with rounded corners. The image will have a landscape aspect ratio, but it needs to be cropped to square to fit inside the the container. We have decided to show only the right side of the photo (making the left side of the photo no longer visible).

Assume the following

  • The photo cannot be pre-processed, I am looking for a CSS only solution
  • The photo can be scaled up/down to fit in the required space
  • The photo must maintain its original aspect ratio (and cannot be stretched to fit)

Example Code

See this fiddle for a demonstration
http://jsfiddle.net/rrbZg/

<style>
.croppedPhoto {
    margin: 20px;
    width: 200px;
    height: 200px;
    overflow: hidden;
    position: relative;
    border-radius: 20px;
    -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
}

.croppedPhoto img {
    height: 200px;
    position: absolute;
    right: 0;
}
</style>
<div class="croppedPhoto">
  <img src="/some/random/photobucket/url">
</div>

The Problem

Chrome and Safari show the image with square corners and does not show rounded corners at all.

Possible Cause

It seems webkit will only allow rounded corners on the container and does not apply the rounded corners to children or crop them in any way. This applies to elements with overflow set as hidden.

What does not work

You can try setting rounded corners on the image itself. But this doesn’t work in my case because that would only put rounded corners on the right side, and square corners on the left.

See the following fiddle to demonstrate:
http://jsfiddle.net/VF6m3/

  • 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-05T19:53:29+00:00Added an answer on June 5, 2026 at 7:53 pm

    This is know issue with simple work around – set image as background and border-radius on the container.

    http://jsfiddle.net/VF6m3/1/

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

Sidebar

Related Questions

Use Case When a user goes to my website, they will be confronted with
I have a use case in which I need to first show the value
Use case is to have a server connect to thousands of users email accounts
Use case: user clicks the link on a webpage - boom! load of files
(Note: This post has been edited to show specific use case. See bottom.) I
Here is my use case I have a search model with two actions search_set
I have various SQL tables and my use case is: I'll choose 5 Products
(Note that the examples are a simplification of my use case.) I have a
My overall use case: I have a Listing model that has many images .
Here's the use case: I'm building a site which will serve various global markets

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.