html - 非全 Angular 内的全 Angular div

标签 html css containers fullscreen

我会创建这样的东西 jsFiddle .
我有一个容器,宽度为 1024px。然后我会在页面中间创建一个全 Angular div,例如一张图片。
在这个例子中,黄色的 div 应该覆盖蓝色的(模拟我的屏幕宽度)。
PS:我简化了容器,但在 wordpress 包装器内部思考,其中 .red 是帖子,.yellow 是全 Angular 图像。 (例如 HERE。我知道这是使用页面而不是帖子制作的)
HTML

<div class="container">
<div class="red">some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text 
    <div class="yellow">some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text
    </div>
    <div class="lime">some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text
    </div>
</div>
</div>

CSS:

 .container{ background: blue; width: 400px;}
    .red {background:red; width: 200px; margin: 0 auto;}
    .yellow {background:yellow; width: 300px;}
    .lime {background:lime; width: 200px; margin: 0 auto;}

最佳答案

您应该在打开.yellow 之前关闭.red,否则.red 将成为.yellow 的父级> 并且如果您将 width:100%; 放在 .yellow 上,它将采用 width:200px; 来自 .red 而不是 .container

这是一个JSFiddle .

关于html - 非全 Angular 内的全 Angular div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22812598/

相关文章:

HTML5 在单个页面上显示多个 Canvas

html - 防止 HTML 表格调整大小溢出

javascript - 从输入框到 jQuery .rotatable 事件的自定义可旋转值

css - React Inline Style - 如何设置自动生成标签的样式?

来自现有 Rails/Unicorn/MySQL 应用程序的 Docker 镜像

linux - 从 centos 中提取图像(最新)时出错,需要身份验证

javascript - 始终将容器定位在顶部

html - 如何将 MDL 上的网格间距调整为基础或 Bootstrap 的网格间距?

html - 将可滚动表格列与CSS中的标题对齐

jquery - Javascript使扩展段落自动关闭