2017-04-17 2 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의 절대 위치를 사용하지 마십시오. 친척을 사용하고 여백을 추가하십시오.

<div class="main" style="position: relative; margin-top: 60px; margin-left: 210px;"> 
    <?php $tpl->Component(); // this outputs tables of data ?> 
</div> 
관련 문제