css - 如何将背景图像溢出屏幕

标签 css image position width overflow

现在我正在编写一个网站,其中所有内容都位于页面的中心。我想要一个小飞机图标,其轨迹在屏幕右侧延伸。

但是,图像会不断为图像的其余部分创建水平滚动条。

如何放置图像,使图像的剩余部分仅在调整浏览器大小时可见。

见附件代码:

.home-planepath {
    position:absolute; 
    left:50%;
    width:100%;
    height:62px;
    z-index: 1;
    margin-top:442px;
    margin-left: -440px;
    overflow: hidden;
    background:url(images/home-planepath.png) no-repeat;
}

最佳答案

你应该设置 overflow:hidden 在您的容器上,即 .homehover 而不是 .home-planepath

关于css - 如何将背景图像溢出屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11588051/

相关文章:

css - dojo RangeSlider 句柄位置错误

html - 使用 border-image/border-width 时居中内容

html - 表格行边框宽度不一致但交替出现是什么?

html - anchor 按钮需要边距

php - Image Upload API XML(仅允许在文档开头声明)

html - div 位置固定但子元素也需要相对位置

css - 如何在 IE 加载时使媒体查询工作?

image - SSRS : Report loading external images, 找不到图片,可以隐藏图片控件吗

管理中的 Django 图像插入

html - 将div内容拉伸(stretch)到页面底部固定位置页脚