CSS调整菜单和内容背景图片

标签 css text background resize

我需要为我的站点设置可调整大小的菜单和内容背景图片,因此当菜单条目过多或内容超出内容背景的边界时,它们都会被拉伸(stretch)。我需要垂直拉伸(stretch)。

请给我一个提示(一个实际的答案也可以)或一个很好的例子的链接吗?

非常感谢您!

最佳答案

您可能需要将一组元素组织成如下所示:

html:

<div id="element">
   <div id="elementTop">
     <div id="elementBottom">

     </div>
  </div>
</div>

CSS:

#element {
  // tileable background image, repeat-y;
}
#elementTop {
  // top, fixed portion of the background image, no-repeat
}
#elementBottom {
  // bottom, fixed portion of the background image, no-repeat, set to:
  background-position: 0 100%;
}

关于CSS调整菜单和内容背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3057139/

相关文章:

html - 如何禁用 Flexbox 中的等高列?

html - 使用 css 插入的响应图像

ios - CLLocationManager startUpdatingLocation() 在后台调用时不起作用

css - 如何结合背景图片和CSS渐变?

android - 奇怪的 ListView 滚动问题

html - 如何将此元素置于页面中央?我只能在彩色背景中将文本居中

HTML & bootstrap/text 覆盖另一个表

Java Swing 自定义文本 JEditorPane

java - 想要最常用的英语单词

ruby - 如何根据位置将一些值写入ruby中的文本文件