侧边栏不会扩展到底部
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了侧边栏不会扩展到底部相关的知识,希望对你有一定的参考价值。
问题在哪里,如何解决?
我不想删除或更改任何css代码,例如float和display。
inliner_content用于将边栏设置在内容行中。
我使用wrap类使页脚有粘性。
我使用一些自定义的类并为表格中的DIV模拟表结构。
此外,此代码是示例代码,并且已经重复了一系列。
.wrap
{
direction: rtl;
height:100%;
width: 100%;
}
#menu_icon_mng
{ display: none;
width: 25px;
height: 25px;
background: url(pics/menu_icon.gif) center;
background-size: 25px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
margin-bottom: 0;
}
.main_m_mng
{
/* height: 14%; */
border-bottom: 1px solid;
height: 25px;
line-height: 25px;
/* display: inline-block; */
/* float: right; */
padding-right: 10px;
/* text-align: center; */
transition: all 0.5s ease 0s;
cursor:pointer;
}
.main_m_mng_name
{
/* height: 14%; */
border-bottom: 1px solid;
height: 25px;
line-height: 25px;
/* display: inline-block; */
/* float: right; */
padding-right: 10px;
/* text-align: center; */
/*transition: all 0.5s ease 0s;*/
/*cursor:pointer;*/
}
.main_m_mng i
{
margin-left: 15px;
float: left;
line-height: 25px;
/* display: inline-block; */
/* color:white; */
}
.main_m_mng:hover
{
background-color: #e0dddd;
padding: 0 20px 0;
margin: 0 1px 0;
/* -webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px; */
}
/* .main_m_mng:after {
border-bottom: 1px solid #000;
content: '';
} */
.sub_menu_mng {
white-space: nowrap;
display: none;
}
.inliner_content {
width: 100%;
min-height: 77%;
overflow: hidden;
/* display: table; */
/* padding-bottom: 8px; */
/* margin-bottom: -19px; */
}
.main_m_link_mng {
transition: all 0.5s ease 0s;
width: 100%;
}
.tbl_frm {
display: block;
}
.tbl_tr {
display: block;
margin-bottom: 10px;
}
.tbl_td {
display: inline-block;
min-width: 150px;
}
.tbl_thead {
display: block;
}
.tbl_th {
display: inline-block;
min-width: 200px;
margin: auto;
}
.footer {
/* position: relative; */
height: 150px;
/* margin-top: -150px; */
background-color: #4a4a4a;
background-size: 116px;
}
<div class="wrap">
<div class="inliner_content">
<div class="shadow_main_mnu_mng" style="
display: none;
/* direction: rtl; */
font-family: monospace;
font-size: 12px;
/* min-height: inherit; */
/* height: 100%; */
width: 20%;
min-width: 150px;
max-width: 150px;
background-color: #8a4747;
float: right;
/* display: flex; */
margin-top: 82.7%;
/* margin-right: -150; */
/* z-index: 100; */
padding-bottom: 100%;
/* margin-bottom: 1px; */
"></div>
<div style="min-height: 100%;height: inherit;/* padding-bottom: inherit; */width: 20%;position: absolute;/* clear: both; */min-width: 150px;max-width: 150px;background-color: #bbb2b2;float: right;/* display: flex; *//* bottom: -62px; *//* flex-direction: column; *//* margin-top: 0; *//* margin-top: -256px; *//* margin-bottom: 40px; */z-index: 100;" class="main_menu_mng">
<div class="main_m_mng_name">Jack Hue </div>
<a href="#" id="menu_icon_mng" onclick="f_menu()" onblur="f_menu()"></a>
<div class="main_menu_list_mng" id="main_menu_list_mng" style="display: block;">
<a class="main_m_link_mng" href=".mpnt=nzmnd">
<div class="main_m_mng">
<i class="fa fa-volume-control-phone"></i>Account Setting
</div>
</a>
<a class="main_m_link_mng" href="new/mpnt=nzmnd">
<div class="main_m_mng">
<i class="fa fa-volume-control-phone"></i>Posts
</div>
</a>
<a class="main_m_link_mng" href="?pmodir=2646&mpnt=nzmnd"><div class="main_m_mng">
<i class="fa fa-volume-control-phone"></i>Users</div></a>
<a class="main_m_link_mng">
<div class="main_m_mng"><i class="fa fa-product-hunt"></i>Admin Users
</div>
</a>
<!-- <div style="position: absolute;z-index: 105;"> -->
<div id="sub_menu_mng" class="w3-animate-top-menu sub_menu_mng">
<div><a href="#">sub menu long</a></div>
<div><a href="?mpnt=test">User Register</a></div>
<div><a href="#">Sub menu3</a></div>
</div>
<!-- </div> -->
<a class="main_m_link_mng">
<div class="main_m_mng"><i class="fa fa-product-hunt"></i>New Admin
</div>
</a>
<!-- <div style="position: absolute;z-index: 105;"> -->
<div id="sub_menu_mng" class="w3-animate-top-menu sub_menu_mng">
<div><a href="#">sub menu long</a></div>
<div><a href="?mpnt=test">User Register</a></div>
<div><a href="#">Sub menu3</a></div>
</div>
<!-- </div> -->
<div class="main_m_mng"><a class="main_m_link_mng"><i class="fa fa-product-hunt"></i> Admin Users old link</a>
<div style="position: absolute;z-index: 105;">
<div id="sub_menu_mng" class="w3-animate-top-menu sub_menu_mng">
<div><a href="#">sub menu long</a></div>
<div><a href="?mpnt=test">User Register</a></div>
<div><a href="#">Sub menu3</a></div>
</div>
</div>
</div>
</div>
</div>
<div style="
/* float: left; */
/* display: inline-block; */
/* width: 73%; */
padding: 0 10px;
padding-right: 160px;
/* margin-right: -150px; */
background-color: blue;
/* z-index: -4; */
top: 0;
min-height: 100%;
" class="content">
<script src="ref/cml_chk.js"></script>
<script src="ref/statlist2.js"></script>
<!--<script src="chk_frm_reg.js" ></script>-->
<input type="hidden" class="prov1" value="6">
<form name="frmreg" method="post" onreset="" onsubmit="return display_err1()" style="
margin-block-end: 0em;
">
<input type="hidden" name="pr_reg_form" value="139">
<input type="hidden" name="pr_reg_form" value="139">
<div style="margin-right:15px">
<div class="tbl_tr">
<div class="tbl_td">Date (Today):</div>
<div class="tbl_td" align="right"> :::::::
</div>
</div>
</div>
<div id="pers_info">
<div width="100%" border="0" dir="rtl" cellspacing="10px" style="margin-right:15px" class="tbl">
<div class="tbl_thead">
<div class="tbl_th" colspan="3">Pers Info
<hr>
<br></div>
</div>
<!--////////////////////////////////////////================================Form main===========================================================================================================/////////////////-->
<div class="tbl_tr">
<div class="tbl_td" width="">Name :</div>
<div class="tbl_td" colspan="2"><input name="fname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td">Last Name :</div>
<div class="tbl_td" colspan="2"><input name="lname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td" width="">ID :</div>
<div class="tbl_td">
<input style="margin-left: 50px" onchange="tel_err2()" name="cmli" id="form_text" type="text" maxlength="10" onkeypress="return checknum(event)" onblur="/*check2()*/" value="">
</div>
</div>
<!--//===================================================================================-->
<!--//===================================================================================-->
<!--//===================================================================================-->
<!-- if(){-->
<div class="tbl_tr" style="display: none">
<div class="tbl_td">none disp :</div>
<div class="tbl_td" colspan="2" title="">
<div>
<select name="prov" class="province"></select>
<select name="city" class="city"></select>
</div>
</div>
</div>
<!--////////////////////////////////////////================================Form main===========================================================================================================/////////////////-->
<div class="tbl_tr">
<div class="tbl_td" width="">Name :</div>
<div class="tbl_td" colspan="2"><input name="fname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td">Last Name :</div>
<div class="tbl_td" colspan="2"><input name="lname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td" width="">ID :</div>
<div class="tbl_td">
<input style="margin-left: 50px" onchange="tel_err2()" name="cmli" id="form_text" type="text" maxlength="10" onkeypress="return checknum(event)" onblur="/*check2()*/" value="">
</div>
</div>
<!--//===================================================================================--> <!--////////////////////////////////////////================================Form main===========================================================================================================/////////////////-->
<div class="tbl_tr">
<div class="tbl_td" width="">Name :</div>
<div class="tbl_td" colspan="2"><input name="fname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td">Last Name :</div>
<div class="tbl_td" colspan="2"><input name="lname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td" width="">ID :</div>
<div class="tbl_td">
<input style="margin-left: 50px" onchange="tel_err2()" name="cmli" id="form_text" type="text" maxlength="10" onkeypress="return checknum(event)" onblur="/*check2()*/" value="">
</div>
</div>
<!--//===================================================================================--> <!--////////////////////////////////////////================================Form main===========================================================================================================/////////////////-->
<div class="tbl_tr">
<div class="tbl_td" width="">Name :</div>
<div class="tbl_td" colspan="2"><input name="fname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td">Last Name :</div>
<div class="tbl_td" colspan="2"><input name="lname" id="form_text" type="text" onkeypress="return checkContentname(event)" value=""></div>
</div>
<div class="tbl_tr">
<div class="tbl_td" width="">ID :</div>
<div class="tbl_td">
<input style="margin-left: 50px" onchange="tel_err2()" name="cmli" id="form_text" type="text" maxlength="10" onkeypress="return checknum(event)" onblur="/*check2()*/" value="">
</div>
</div>
<!--//===================================================================================-->
</div>
<!--//===================================================================================-->
<!--//===================================================================================-->
<!--//===================================================================================-->
<!-- -->
<!-- //================================================================================-->
<!-- //================================================================================-->
<!-- //================================================================================-->
</div>
</div>
<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text<br>test text
<br>
<br>
</form>
</div>
</div>
<div class="spacer_ftr" style="height: 150px;"></div>
</div>
<div class="footer">
footer
</div>
我使用clearfix,显示:表格,并且显示:表格单元技巧,但有一定的作用
通过将position: relative;
添加到body
元素,边栏将完全展开。
您的.main_menu_mng
有一个position: absolute;
,但没有一个祖先被放置,因此您的元素相对于根元素(或“初始包含块”)以及来自W3C的位置:
根元素所在的包含块是一个称为初始包含块的矩形。 对于连续媒体,它具有视口的尺寸并固定在画布原点;这是分页媒体的页面区域。初始包含块的“ direction”属性与根元素相同。
https://www.w3.org/TR/CSS2/visudet.html#containing-block-details
因此,在没有相对位置的父对象的情况下,元素的高度取决于根元素(即视口)的高度。
您可以将position: relative;
添加到body
中,也可以将其应用于.wrap
或.inliner_content
(在这两种情况下,它将在页脚间隔符处停止。)
[这里有一个示例,我在其中添加了position: relative;
到.inliner_content
。如果您希望它扩展到页脚,则如果不需要其他内容,可以将其删除。
.spacer_ftr
.wrap
{
direction: rtl;
height:100%;
width: 100%;
}
#menu_icon_mng
{ display: none;
width: 25px;
height: 25px;
background: url(pics/menu_icon.gif) center;
background-size: 25px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
margin-bottom: 0;
}
.main_m_mng
{
/* height: 14%; */
border-bottom: 1px solid;
height: 25px;
line-height: 25px;
/* display: inline-block; */
/* float: right; */
padding-right: 10px;
/* text-align: center; */
transition: all 0.5s ease 0s;
cursor:pointer;
}
.main_m_mng_name
{
/* height: 14%; */
border-bottom: 1px solid;
height: 25px;
line-height: 25px;
/* display: inline-block; */
/* float: right; */
padding-right: 10px;
/* text-align: center; */
/*transition: all 0.5s ease 0s;*/
/*cursor:pointer;*/
}
.main_m_mng i
{
margin-left: 15px;
float: left;
line-height: 25px;
/* display: inline-block; */
/* color:white; */
}
.main_m_mng:hover
{
background-color: #e0dddd;
padding: 0 20px 0;
margin: 0 1px 0;
/* -webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px; */
}
/* .main_m_mng:after {
border-bottom: 1px solid #000;
content: '';
} */
.sub_menu_mng {
white-space: nowrap;
display: none;
}
.inliner_content {
width: 100%;
min-height: 77%;
overflow: hidden;
position:relative;
/* display: table; */
/* padding-bottom: 8px; */
/* margin-bottom: -19px; */
}
.main_m_link_mng {
transition: all 0.5s ease 0s;
width: 100%;
}
.tbl_frm {
display: block;
}
.tbl_tr {
display: block;
margin-bottom: 10px;
}
.tbl_td {
display: inline-block;
min-width: 150px;
}
.tbl_thead {
display: block;
}
.tbl_th {
display: inline-block;
min-width: 200px;
margin: auto;
}
.footer {
/* position: relative; */
height: 150px;
/* margin-top: -150px; */
background-color: #4a4a4a;
background-size: 116px;
}
以上是关于侧边栏不会扩展到底部的主要内容,如果未能解决你的问题,请参考以下文章