2016-08-28 11 views
1

divのオーバーフローをスクリーンの100%にあてようとしています。子divが親divをオーバーフローします

私の例では、私たちの会社の赤いバーが、画面の100%にあてはまるボーダーのdivをオーバーフローさせたいと考えています。

HTML:

<div id="wrapper"> 
    <!-- header of the page --> 
    <header id="header"> 
     <div class="container"> 
      <div class="row"> 
       <div class="col-xs-12 holder"> 
        <!-- logo of the page --> 
        <a href="#" class="nav-opener visible-xs"><i class="fa fa-bars"></i></a>       
        <div class="nav-holder"> 
         <!-- nav of the page --> 
         <nav id="nav"> 
          <ul class="list-inline"> 
           <li><a href="index.html">Home</a></li> 
           <li class="active"><a href="quemsomos.html">About Us</a></li> 
           <li><a href="area-atuacao.html">Area</a></li> 
           <li><a href="servicos.html">Services</a></li> 
           <li><a href="contato.html">Contact</a></li> 
          </ul> 
         </nav> 
        </div> 
       </div> 
      </div> 
     </div> 
    </header> 
    <!-- banner-block of the Page --> 
    <div class="banner-block"> 
     <div class="container"> 
      <div class="row row-about"> 
       <div class="col-xs-12 banner-box"> 
        <header class="banner-heading"> 
         <h1>About Us</h1> 
        </header> 
       </div> 
      </div> 
     </div> 
    </div> 
    <!-- contain main informative part of the site --> 
</div> 

CSS:

.banner-block { 
    overflow: hidden; 
    position: relative; 
} 

.banner-block:after { 
    position: absolute; 
    content: ""; 
    top: 0; 
    bottom: 0; 
    left: 0; 
    right: 0; 
} 

.banner-block:after { 
    z-index: -1; 
    background: rgba(0, 0, 0, .6); 
} 

.banner-block .bg-stretch { 
    z-index: -1; 
} 

.banner-block.centercenter-block { 
    text-align: center; 
} 

.banner-block.right-block { 
    text-align: right; 
} 

.banner-box { 
    height: 252px; 
    padding-top: 158px; 
    white-space: nowrap; 
} 

.banner-box .banner-heading { 
    display: inline-block; 
    white-space: normal; 
    vertical-align: middle; 
} 

.banner-box:before { 
    content: ""; 
    vertical-align: middle; 
    display: inline-block; 
    height: 100%; 
    width: 1px; 
    overflow: hidden; 
    margin: 0 0 0 -5px; 
} 

.row-about { 
    background: red; 
} 
.banner-heading { 
    margin: 11px 0 0; 
    position: absolute; 
} 

.banner-heading h1 { 
    margin: -70px 120px 15px; 
    color: #fff; 
    text-transform: uppercase; 
    font-size: 36px; 
    line-height: 40px; 
} 
#wrapper { 
    position: relative; 
    overflow: hidden; 
    border: 1px solid black; 
    margin:20px; 
} 

#header { 
    bottom: auto; 
    z-index: 9999; 
    background: #fff; 
} 

http://jsfiddle.net/dempc3go

+0

申し訳ありませんが、あなたの質問には..私は黒の境界線の外に出るために赤のdivをしたい –

+0

本当に明確ではない明確ということでしょうか? – dante

答えて

0

あなたがの残りの部分に完全に別個の要素として扱うことができる指定された設計の途中越え赤いバーデザイン。私はあなたの質問を理解して

.red-tape { 
    top: 50px; 
    height: 80px; 
    left: 0; 
    right: 0; 
    top: 70px; 
    background-color: red; 
    position: absolute; 
} 

.container { 
    border: 1px solid black; 
    height: 500px; 
    width: 800px; 
    margin: 0 auto; 
    position: relative; 
} 

ul { 
    float: right; 
} 

ul li { 
    display: inline-block; 
} 

Codepen example

+0

赤いdivが黒の境界から外に出て欲しい... – dante

+0

@danteしたがって、ラッパーからボーダーを削除し、ヘッダーに追加してください - http://jsfiddle.net/dempc3go/3/ – alanbuchanan

+0

を見てくださいこれは..より明確になります.. http://gilbertogm.xyz/1.png – dante

0

:あなたはこのような何かを行うことができます。クラス.containerを使用しています。幅はwidth: 750px;です。だから、それはあなたがあなたの「私たちについてなるだろう#wrapperからマージンやボーダーを、取り除くことができ、私が正しくあなたの質問を理解していれば、画面全体に合うように、また、それは100%まで成長

<div class="banner-block"> 
     <div class="container"> 
      --- 
     </div> 
</div> 
+0

うーん、しかし、どのように修正されますか?私はコンテナdivを取り出したが、私はまだそれを得ることができない – dante

0

を聞かせてdoesntの"セクションは画面全体にフィットします。

http://jsfiddle.net/dempc3go/2/

CSS:

.banner-block { 
    overflow: hidden; 
    position: relative; 
} 

.banner-block:after { 
    position: absolute; 
    content: ""; 
    top: 0; 
    bottom: 0; 
    left: 0; 
    right: 0; 
} 

.banner-block:after { 
    z-index: -1; 
    background: rgba(0, 0, 0, .6); 
} 

.banner-block .bg-stretch { 
    z-index: -1; 
} 

.banner-block.centercenter-block { 
    text-align: center; 
} 

.banner-block.right-block { 
    text-align: right; 
} 

.banner-box { 
    height: 252px; 
    padding-top: 158px; 
    white-space: nowrap; 
} 

.banner-box .banner-heading { 
    display: inline-block; 
    white-space: normal; 
    vertical-align: middle; 
} 

.banner-box:before { 
    content: ""; 
    vertical-align: middle; 
    display: inline-block; 
    height: 100%; 
    width: 1px; 
    overflow: hidden; 
    margin: 0 0 0 -5px; 
} 

.row-about { 
    background: red; 
} 
.banner-heading { 
    margin: 11px 0 0; 
    position: absolute; 
} 

.banner-heading h1 { 
    margin: -70px 120px 15px; 
    color: #fff; 
    text-transform: uppercase; 
    font-size: 36px; 
    line-height: 40px; 
} 
#wrapper { 
    position: relative; 
    overflow: hidden; 
} 

#header { 
    bottom: auto; 
    z-index: 9999; 
    background: #fff; 
} 
+0

しかし、私は境界を維持したい.. – dante

関連する問題