2
我试图用CSS制作一个页面,其中divs的内容互不重叠。当内容从主区域(白色区域)溢出时,会出现滚动条,您可以滚动边栏和标题的内容(忽略红线文本...这仅仅是我的调试信息)。防止重叠div中的CSS
我没有将CSS从HTML中分离出来,所以我为这个混乱的布局道歉。 div中的样式标签就是我用来定位页面内容的东西。
此代码可以在https://jsbin.com/gesuser/edit?html和这篇文章的底部找到。
如何防止主div滚动页眉和侧边栏?我可以使用框架来做到这一点,但我宁愿不使用那些旧技术。 :)
任何帮助将不胜感激。
<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 -->
您可以在演示中仅显示HTML和CSS吗?某处托管或使用JSBin? –
你为什么在DOM中内嵌你的CSS? – frenchie
好的。以下是JSBin上的代码:https://jsbin.com/gesuser/edit?html – UltraJ