html - 更改 css 以扩展内容

标签 html css

他跟随css如何使div包装器占据整个屏幕而不仅仅是在中心

body {
   margin:0px;
   padding:0px;
   background:#71726e;
   }
div, p, span, a, h1, h2, h3, h4, h5, h6, form {
   margin:0px;
   padding:0px;
   }

.wrapper {
   margin:0px auto;
   padding:0px;
   overflow:hidden;
   width:951px;
   background:url(../images/mid-shadow.jpg) repeat left top;
   }
 left-gap1 {
   margin:    0px ;
   padding:0px;
   font-size:0px;
   line-height:0px;
   width:6px;
   float:left;
   }
.right-gap1 {
   margin:0px;
   padding:0px;
   font-size:0px;
   line-height:0px;
   width:6px;
   float:left;
   }
.main {
   margin:0px;
   padding:0px;
   width:939px;
   float:left;
   }
.header {
   margin:0px;
   padding:0px;
   width:939px;
   float:left;    
   }
.nav-area {
   margin:0px;
   padding:0px;
   width:939px;
   height:54px;
   float:left;
   background:#000000;
   }

最佳答案

将包装宽度更改为 100%

.wrapper {
   margin:0px auto; /* I guess you wont need this here */
   padding:0px;
   overflow:hidden;
   width:100%;   /* Change This */
   background:url(../images/mid-shadow.jpg) repeat left top;
   }

注意:这只会使用屏幕的 100% 宽度而不是高度,如果您在网站中使用图像作为背景,我建议您在 <body> 上使用背景图像属性。标签。

根据您的新要求进行编辑

你想要类似 this 的东西?

关于html - 更改 css 以扩展内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11626805/

相关文章:

Javascript 函数不在加载时获取数据

html - 最小高度 flexbox 容器

CSS 菜单在 IE7 中左对齐 - 如何在所有浏览器(IE7、IE8、firefox 等)中使菜单居中

css - 我的链接类型 ="value"中需要这个吗?

css - Bootstrap 3 中的按钮边距 : where did they come from?

html - :target is not showing

javascript - 避免在手机上下载图片

jquery - 分隔符在 HTML5 中不占 100%

javascript - Google 的 buckyball doodle 是如何实现的?

css - 使嵌入行为像一个 div