html – 将元素从容器中断开

前端之家收集整理的这篇文章主要介绍了html – 将元素从容器中断开前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的所有内容都包含在一个固定宽度的容器元素中.

但我有一个< div>我想要“突破”该容器跨越页面的整个宽度.

http://dabblet.com/gist/3207168

正如你在这个例子中看到的那样,我得到了< div>突破,但由于它绝对定位,它不会影响页面的流动…这是我想要做的.

我希望它像在页面的流程中一样行动,但是扩展窗口的整个宽度.

解决方法

也许 http://jsfiddle.net/sYv9g/1/
.wrapper {
    width:300px;
    margin:0 auto;
    background:yellow;
}
.break {
    text-align:center;
    font-weight:bold;
    background:rgba(255,0.5);
    margin-left:-100%;
    margin-right:-100%;
}
<div class="wrapper">
    <h1>Ipsum Dapibus Pellentesque Pharetra</h1>
    <p>Duis mollis,est non commodo luctus,nisi erat porttitor ligula,eget lacinia odio sem nec elit. Etiam porta sem malesuada magna mollis euismod. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus,porta ac consectetur ac,vestibulum at eros. Sed posuere consectetur est at lobortis.</p>
    <div class="break">This should be full width</div>
    <p>Fusce dapibus,tellus ac cursus commodo,tortor mauris condimentum nibh,ut fermentum massa justo sit amet risus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Maecenas sed diam eget risus varius blandit sit amet non magna. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Lorem ipsum dolor sit amet,consectetur adipiscing elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
    <div class="break">This should be full width</div>
    <p>Nullam id dolor id nibh ultricies vehicula ut id elit. Lorem ipsum dolor sit amet,consectetur adipiscing elit. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus. Donec ullamcorper nulla non metus auctor fringilla.</p>
    <p>Vestibulum id ligula porta felis euismod semper. Cum sociis natoque penatibus et magnis dis parturient montes,nascetur ridiculus mus. Lorem ipsum dolor sit amet,consectetur adipiscing elit. Curabitur blandit tempus porttitor.</p>
</div>
原文链接:https://www.f2er.com/html/231465.html

猜你在找的HTML相关文章