How to move Image in CSS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to move Image in CSS?

I want to make my website an move all image to the center

2nd Jun 2021, 7:36 AM
Christiano
Christiano - avatar
2 Answers
+ 1
Hello! For getting the image to a certain dimension use in the img tag this : <Img scr="image.jpeg" width="120" height="120"> you should define it IN PIXELS. Then refeer to it in css and use those rules : Position : absolute; Top : //position + px Left : //position + px Right : //position + px Left : //position+px Ignore those //, theyre comments so the text would be : .myDiv { position : absolute; top : 220px; } Dont use top + bottom or left + right, It wont work. I hope to have been helpful! Bye :) Please upvote my question!
5th Jun 2021, 7:13 PM
Ettore Giacomini
Ettore Giacomini - avatar
+ 1
Try <div><img src=“img.jpg”/> </div> Then in css try: div { text-align: center; } Alternatively you could use css flexbox
2nd Jun 2021, 8:02 AM
Ollie Q
Ollie Q - avatar