❓❓❓ How to make an image so that only the center of the image is displayed, and not the whole image? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

❓❓❓ How to make an image so that only the center of the image is displayed, and not the whole image?

Need to make a 100*100 round image. It works out. But how can I make it show only the center of the image? //failed attempts in the attached code: https://code.sololearn.com/WtnsFDNJ6ZsY/?ref=app

15th May 2023, 12:03 PM
PR PRGR
PR PRGR - avatar
6 Answers
+ 5
You can try to put the image as the background of a div, example: background-image: url('path/to/your/ image.jpg'); background-repeat: no-repeat; background-position: center; background-size: cover;
15th May 2023, 2:01 PM
Beldavisss 👾
Beldavisss 👾 - avatar
+ 5
This might be useful for you to read: https://www.w3schools.com/css/css3_images.asp
15th May 2023, 2:18 PM
Ausgrindtube
Ausgrindtube - avatar
+ 4
Why not make a div container and position the image in it.
15th May 2023, 2:04 PM
sanni olamide
sanni olamide - avatar
+ 2
Thanks sanni olamide. w3schools.com is a great website
15th May 2023, 3:05 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
https://code.sololearn.com/W9Gd2kMajfHQ/?ref=app I try to solve this by putting the image into a container. Change the proportion of the image. And positioning manually the image based on its x and y coordinates. Hope this help
15th May 2023, 4:24 PM
Rizal Sudiarso
Rizal Sudiarso - avatar
+ 1
Great link bro
15th May 2023, 2:21 PM
sanni olamide
sanni olamide - avatar