Размер изображения = 1050x500
В CSS я использую ширину и свойства высоты, но оно не может изменить изображение. Что мне сделать, чтобы соответствовать изображению на дисплее, используя только CSS? >
Код: Выделить всё
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.iamge-container {
width: 60%;
max-width: 100%;
max-height: 100%;
overflow: hidden;
height: auto;
margin: 50px auto;
}
.hero-image {
width: 60%;
height: auto;
object-fit: cover;
}< /code>
[img]/mini pojects/images/mountain.png[/img]
Majestic Heights: The Enchanting Allure of Everest
[h4]Exploring the World's Tallest Peak and Its Timeless Mystique[/h4]
Towering at an awe-inspiring 8,848.86 meters, Mount Everest stands as the crown jewel of the Himalayan range, drawing adventurers and dreamers from across the globe. Its snow-clad peaks, rugged terrain, and the surrounding serene landscapes create a breathtaking tableau of nature's grandeur.
Установка изображения для отображения в соответствии с соотношением.
Подробнее здесь: https://stackoverflow.com/questions/793 ... -using-css
Мобильная версия