[英]My div only reaches half the page even on 100% height
I have this page here and the div .menu-content
only reaches half the page even on 100% height. 我在这里有此页面,即使在100%高度上,div
.menu-content
只能达到页面的一半。 I really have no idea why. 我真的不知道为什么。
Thanks! 谢谢!
<div class = "menu-content">
<div class="wrapper" style = "background-color:white; height:100%; width:750px;">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php global $rd_data; if ($rd_data['rd_error_text']) { ?>
<?php echo $rd_data['rd_error_text']; ?>
<?php } else { ?>
Oops, It looks like an error has occured
<?php } ?>
<?php endif; ?>
</div>
Try this css.. 试试这个CSS。
.menu-content {
display: table;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
position: relative;
}
You need to remove height:100%;
您需要去除
height:100%;
on .menu-content .wrapper
in your CSS code and in the inline style you set on it. 在CSS代码中的
.menu-content .wrapper
以及您在其上设置的内联样式上。
That way it will be set to default height:auto;
这样,它将被设置为默认的
height:auto;
and the height will be calculated by it's content. 高度将根据其内容进行计算。
you have to use css this way. 您必须以这种方式使用CSS。 use the
overflow:auto
property and remove the unnecessary property like z-index
and position
from class .wrapper
. 使用
overflow:auto
属性,并从类.wrapper
删除不必要的属性,例如z-index
和position
。
.menu-content {
background-color: #FFFFFF;
height: 100%;
overflow: auto;
}
.wrapper {
margin: 0 auto;
width: 750px;
}
添加html {height: 100%}
,它应该可以工作。
to solve this you can simply add a div with style = "clear:both;"
为了解决这个问题,您只需添加一个
style = "clear:both;"
的div即可style = "clear:both;"
at the end of your div .menu-content
在您的div
.menu-content
末尾
like this : 像这样 :
<div class="menu-content">
.....................
<div style="clear:both;"></div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.