February 11, 2022, 5:50pm
Project: Personal Portfolio Webpage
My images for life of me won’t center no matter what I try, what am I doing wrong? My pictures were uploaded to Google Photos if that matters.
I am currently working in mobile view, 430px width in CodePen.
February 11, 2022, 6:21pm
I figured it out, I was using
background-image: url(); in my css for the images rather than using an
img tag in my HTML. Not sure why that works but it did. Anyone know why?
February 11, 2022, 8:20pm
Did you try to use the CSS property
background-position? I also checked the link of your image but it doesn’t seem to work.
February 11, 2022, 8:37pm
Yes I did try
background-position: cover; and the pictures were all aligned from the left. Oh I need to update my CodePen, I’m working out of VS Code at the moment.
February 11, 2022, 8:38pm
Did you also try the value
center? You wanted to center it right?
February 11, 2022, 8:43pm
Hmmm… I don’t know if I tried that or not, I did end up getting it sorted out though if you check my CodePen. I tried to center it other ways but possibly not with
February 11, 2022, 8:54pm
Now it seems you are not using them as background. As you said, you decided to put them into the HTML code. If you wanted to center the background, I think the property/value
background-position: center; could work, as it’s suppose to center the background.
February 11, 2022, 9:10pm
Next time I’ll have to try that! Thanks
August 13, 2022, 9:12am
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.