2017-04-17 9 views
2

divのコンテンツが重なり合わないCSSでページを作成しようとしています。コンテンツがメインディビジョン(白い部分)からオーバーフローすると、スクロールバーが表示され、サイドバーとヘッダーの内容をスクロールすることができます(赤い線のテキストは無視されます...これは私のデバッグ情報です)。CSSのオーバーラップdivの防止

私はCSSからHTMLを分離しなかったので、面倒なレイアウトについてお詫び申し上げます。 divのスタイルタグは、ページ上にコンテンツを配置するために使用しているタグです。

このコードは、https://jsbin.com/gesuser/edit?htmlとこのポストの末尾にあります。

ヘッダーとサイドバーでメインdivをスクロールできないようにするにはどうすればよいですか?私はフレームを使用してこれを行うことができましたが、私はむしろその古い技術を使用しません。 :)

は、このようにする必要があります: enter image description here ないが、これを好き: enter image description here

任意の助けをいただければ幸いです。

<div class="container"> 
     <div class="header" style="position: fixed; width: 100%; height: 50px; background-color: #133068;"> 
      <div id="appname" style="float: left;"> 
       <a href="index.php"><label style="position: relative; top: 12px; left: 5px; font: bold 20pt/22pt 'Syncopate', Arial, sans-serif; color: white;">Bluebook</label></a> 
      </div> 

      <div id="searchbar" style="position: fixed; float: right; top: 12px; right: 20px;"> 
       <form id="" name="form_Search_All" action="search.php" method="post"> 
        <input type="text" id="text_Search" style="width: 350px;" name="text_Search" placeholder=" search all departments" /> 
        <input type="submit" name="btnSearch_All" value="+" /> 

        <input type="radio" id="radio_Search_BB" name="radio_Search" value="BB" checked /><label style="color: white;">BB</label> 
        <input type="radio" id="radio_Search_RC" name="radio_Search" value="RC" /><label style="color: white;">RC</label> 
       </form> 
      </div> 
     </div> 

     <div class="sidebar grad" style="position: fixed; top: 50px; width: 200px; height: 100%; background-color: #4e6799; z-index: -1;"> 
      <div class="btn-group" style="position: relative; top: 20px;"> 
       <?php if ($site->IsAdmin()) : ?> 
        <a href="logout.php"><button class="button">ADMIN LOGOUT</button></a> 

       <?php else : ?> 
        <a href="login.php"><button class="button">ADMIN LOGIN</button></a> 

       <?php endif; ?> 

       <a href="index.php"><button class="button">SEARCH PAGE</button></a> 
      </div> 

      <div id="version" style="position: absolute; bottom: 50px; margin: 5px; font: bold 9pt/11pt Arial; color: #9a9797;"> 
       <label>Version 2.0.0</label> 
      </div> 
     </div> 

     <div class="main" style="position: absolute; top: 60px; left: 210px;"> 
      <?php $tpl->Component(); // this outputs tables of data ?> 
     </div> <!-- main --> 

    </div> <!-- container --> 
+1

デモにHTMLとCSSだけを表示できますか? JSBinをホストまたは使用している場所 –

+0

DOMでCSSをインライン展開するのはなぜですか? – frenchie

+0

JSBinのコードは次のとおりです:https://jsbin.com/gesuser/edit?html – UltraJ

答えて

0

メインディビジョンに絶対位置を使用しないでください。相対的なマージンを使用してください:

<div class="main" style="position: relative; margin-top: 60px; margin-left: 210px;"> 
    <?php $tpl->Component(); // this outputs tables of data ?> 
</div> 
関連する問題