html - 如何让主要内容出现在中间的背景前面?

标签 html css positioning

我想知道如何使主要内容出现在页眉下方页脚上方页面中间的背景前面。例如在这个网站上。 http://cdn.webfactore.co.uk/web_design_example_551_large.jpg我不确定它是否涉及高度和宽度或其他任何内容。请帮帮我。如何让主要内容出现在中间背景之前?

最佳答案

这是一个快速的 HTML5 框架

<!doctype html>

<html>

<head>

</head>

<body>

  <header>

    <div id="header-wrapper">


    </div> 

  </header>


  <div id="content">



  </div>


  <footer>

    <div id="footer-wrapper">


    </div>

  </footer>


</body>

</html>


html,
body {
  background: #ccc;
  font: 62.5% Arial, Helvetica, sans-serif;  /* --- Setting body font at 62.5% makes 1.2em equal to 12px --- */
  line-height: 1.7em;
  letter-spacing: 1px;
  color: #222;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
header {
  background: #555;
  position: relative;
  width: 100%;
  height: 60px;
  margin: 0;
  padding: 0;
}
#header-wrapper {
  width: 960px;
  height: 100%;
  margin: 0 auto;
  padding: 0;
}
#content {
  background: #fff;
  position: relative;
  width: 960px;
  height: auto;
  margin: 0 auto;
  padding: 0;
}
footer {
  background: #555;
  position: absolute;
  width: 100%;
  height: 200px;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 0;
}
#footer-wrapper {
  width: 960px;
  height: 100%;
  margin: 0 auto;
  padding: 0;
}

关于html - 如何让主要内容出现在中间的背景前面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18808877/

相关文章:

javascript - CSS 动画表现怪异

iphone - iPhone 和 iPad 中的 SASS 后台问题

php - 放入文本时,CSS div 框会向下移动一点

css - 当宽度为 100% 时向元素添加滚动条

javascript - 如何在 jQuery 动态生成的列表中触发事件

html - 如何居中此图像和悬停效果?

c# - 如何从代码后面添加样式?

javascript - IE7 文本大小调整

css - 对 span 在 div 中的 CSS 定位感到困惑

css - 使用 CSS 在网格中定位不同大小的图像