Center image on page HTML and CSS

887 views Asked by At

I created a landing page for the website www.foscaintepidario.it But I want the image on it to be centered, and remain centered, also when the browser-view is changed. Changed in the perspective of size, but also the switch from landscape to portrait and the other way around. In het HTML/CSS I currently make a distinction between the portrait and landscape version, they both have their own image.

Hope you can help me.

2

There are 2 answers

2
Mahdi P. On BEST ANSWER

you can use css background elements to have a clean view.

background-image: url(url to image);
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
0
Leon N On

I finally solved it. The solution with the background-image works fine. The only thing I had to add was the height: 100vh parameter!

Thnx for your support