gpt4 book ai didi

html - 标题图像位于中心,同时保持其尺寸没有水平滚动

转载 作者:行者123 更新时间:2023-11-28 09:57:27 25 4
gpt4 key购买 nike

我将尽我所能解释这一点。我有一个 2560x400 像素的标题图片。但例如图像可能是(ex.2 4000x400px)。我希望能够将图像定位在屏幕中间,因此在给定屏幕中间拍摄 ex.2 将是标题图像的 2000 像素。

我一切顺利,设法删除了水平滚动,但如果有人能帮助我,我需要一些帮助:)。

html

<img class="pop" src="My image 2560x400" alt="">

CSS

.pop { 
width: 2560px;
height: 100%;
overflow: hidden;
position: center;
}

最佳答案

试试这个:

.pop {
width: 2560px;
height: 100%;
margin-left: auto;
margin-right: auto;
overflow: hidden;
position: relative;
}

关于html - 标题图像位于中心,同时保持其尺寸没有水平滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24851429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com