Answer the question
In order to leave comments, you need to log in
How can you crop a photo with CSS?
Hello everyone
There are photos, 600x400 (20 pieces). I need to make them round, that is border-radius: 50%
. But, since it is not square, it looks bad. I can cut all of them with my hands in FS up to 400x400, but 20 pieces are so-so fun to click. Is there a solution with CSS?
Thanks
Answer the question
In order to leave comments, you need to log in
It is difficult to answer the question, since there are several solutions and they depend on the situation, but for example, you can try this:
.img {
width: 400px;
height: 400px;
object-fit: cover;
object-position: center;
}
.wrapper {
width: 400px;
height: 400px;
border-radius: 50%;
overflow: hidden;
}
.img {
transform: translateX(-100px);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question