css - 如何使内容区域的颜色与包装器的颜色不同?

标签 css navigation textarea

我想做两件事:第一件事是将宽度为 1200 像素的内容区域居中。我希望导航菜单也是这个宽度。我想做的第二件事是将此内容区域的颜色更改为白色;同时允许内容区域边缘周围的背景区域(包装)保持相同的颜色。

/* BACKGROUND */

body {
 background-color: #ECF0F1;
 overflow-y: scroll;
 }

*{
 margin:0;
 padding:0;
 }

img {
 border:0;
 }

/* AREA */

#wrapper {
 margin:0 auto;
 position: absolute;
 width: 1200px;
 background:#339999;
 font-size:1.20em;
 }

/* HEADER */

#header {
 margin-top: 40px;
 height: 100px;
 width: 100%;
 }

/* PAGE */

#content {  
 min-height:400px;
 padding:23px;
 text-align:justify;
 line-height:1.5;
 }

如果你能告诉我如何设置这个内容区域和导航栏,对于我和其他希望以类似方式格式化网页的用户来说,那就太好了

谢谢!

最佳答案

#menu {
    position: fixed;
    z-index: +1;
    width: 1200px;
    background-color: #E74C3C;
    height: 100px;
    margin: 0 auto; /* add this to make it center */
    left: 0; /* to give position of fixed menu */
    right: 0; /* to give position of fixed menu */
}
#content {
    min-height: 400px;
    background-color: #fff; /* to color white your content */
    padding: 23px;
    text-align: justify;
    line-height: 1.5;
}

关于css - 如何使内容区域的颜色与包装器的颜色不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24428785/

相关文章:

html - 在 flexbox 布局中使图像 + 容器高度不超过 100vh 单位

html - CSS 和 HTML 居中导航栏

mvvm - Caliburn.Micro、MVVM 和业务层

css - Twitter Bootstrap 2.0 中的中心导航栏

javascript - 单击时显示/隐藏按钮在某些浏览器上会丢失样式

html - 背景图片 : Does not continue in white color

mysql - textarea 发布到 mysql 不工作

javascript - 将选定的选项添加到 TEXTAREA,以逗号分隔

jquery - 如何在 IE 中向文本区域添加缩放器?

javascript - HTML - 带有 "more"下拉菜单的动态水平导航