Html 标题图像位于中心位置,同时保持其尺寸不变,没有水平滚动
我将尽我所能解释这一点。我有一个标题图像是2560x400像素。但例如,图像可以是ex.2 4000x400px。我希望能够将图像定位在屏幕中间,因此在给定屏幕的中间取EX.2将是头图像的2000像素。 我已经得到了好,管理删除水平滚动,但我需要一些帮助,如果有人可以帮助我: html 试试这个:Html 标题图像位于中心位置,同时保持其尺寸不变,没有水平滚动,html,css,Html,Css,我将尽我所能解释这一点。我有一个标题图像是2560x400像素。但例如,图像可以是ex.2 4000x400px。我希望能够将图像定位在屏幕中间,因此在给定屏幕的中间取EX.2将是头图像的2000像素。 我已经得到了好,管理删除水平滚动,但我需要一些帮助,如果有人可以帮助我: html 试试这个: .pop { width: 2560px; height: 100%; margin-left: auto; margin-right: auto; overf
.pop {
width: 2560px;
height: 100%;
margin-left: auto;
margin-right: auto;
overflow: hidden;
position: relative;
}
谢谢你的回复,非常感谢。我试着使用这种样式,它将图像定位在页面的左侧,而不是中间。对我来说效果很好。请检查周围其他元素的样式。我已经看了,看了xD可能和body标签有关。实际上,我并没有对整个页面进行编码,这是一个预先制作好的tumblr主题。my tumblr是页眉是树图像,这与您使用的样式有关。我意识到我有点需要,所以如果你没有时间,你不必回答:是的,这可能是因为标签必须在标签里面。可能是主体标签的宽度小于或向左浮动。
.pop {
width: 2560px;
height: 100%;
overflow: hidden;
position: center;
}
.pop {
width: 2560px;
height: 100%;
margin-left: auto;
margin-right: auto;
overflow: hidden;
position: relative;
}