css - 溢出水平图像而不会导致滚动

标签 css

我正在努力使设计工作正常,图像水平溢出到某个点,但不会导致滚动条。最好用图片解释:

         +-------------------------------------------+
         |                                           | <-- the window
+-------------------------------------------------------------+
|                                                             |
| the image that is really wide                               |
|                                                             |
+-------------------------------------------------------------+
         |                                           |
         |    +--------------------------------+     |
         |    |                                |     |
         |    |    content that should cause   |     |
         |    |    a horizontal scroll         |     |
         |    |                                |     |
         |    +--------------------------------+     |
         |                                           |
         +-------------------------------------------+

基本上,内容是960px。宽图像为 1800px。我希望水平滚动条低于 960px,但不高于,并且我希望所有内容在高于 960px 时居中。

我知道我以前见过类似的设计。如果有人能给我指点一个,那就太好了,或者如果你碰巧有它的 CSS :)

最佳答案

使用overflow对于图片。 使用 min-width内容。

关于css - 溢出水平图像而不会导致滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13595200/

相关文章:

jquery - float Div 溢出滚动浏览器

html - 将代码复制到下拉菜单按钮以创建第二个下拉菜单按钮时遇到问题

html - 如何防止浏览器在移动视口(viewport)中加载图像

html - Aptana - 从 HTML 元素跳转到它的 CSS 样式?

html - iO7 上的 Safari CSS 背景大小问题

html - Bootstrap 模式 : class ="modal fade" causing problems

php - 侧边栏显示以下内容

html - 如何在 SVG 中将文本居中放置在对象中?

html - 两列布局,内容区域比例相同,因为窗口大于内容区域

javascript - 可折叠的 CSS 和 JS 在 Angular 应用程序中不起作用