简体   繁体   English

在twitter bootstrap中,侧边栏(面板)的高度为100%

[英]Issue with 100% height for Sidebar (Panel) in twitter bootstrap

I'm in trouble when I use Sidebar (Panel) in twitter bootstrap. 当我在twitter bootstrap中使用Sidebar(Panel)时,我遇到了麻烦。 Here Is snap of that Sidebar (Panel). 这是侧边栏(面板)的快照。

在此输入图像描述

And Here is my CSS code for it. 这是我的CSS代码。

    .sharecartside .content {
    height: 100% !important;
    min-height: 100%;
    padding: 18px 10px 20px 30px;
}
.sharecartside {
    height: 100%;
    margin: 1px 0 0 508px;
}
.sharecartside {
    background: url("../images/bg_sidepannel.png") repeat-y scroll 0 0 transparent;
    float: right;
    margin: 1px 0 0 400px;
    position: absolute;
    width: 300px;
}

Any help will be appreciated. 任何帮助将不胜感激。 Thank you. 谢谢。

In order to make 'height:100%' work for any HTML element, its parent item should have a height value defined. 为了使'height:100%'适用于任何HTML元素,其父项应定义高度值。 Or the item will expand to height of the nearest ancestor with a height defined. 或者项目将扩展到最近的祖先的高度,并定义高度。

If all the ancestors of an element have no height defined or defined in percentage, then in order to have the element to expand to the height of the page, you should give both 'body' and 'html' a 100% height. 如果元素的所有祖先都没有以百分比定义或定义高度,那么为了使元素扩展到页面的高度,您应该为'body'和'html'赋予100%的高度。

If you are using bootstrap responsive, using 如果您使用bootstrap响应,请使用

   html,body{ height:100%}

in css should solve the problem. 在CSS中应该解决问题。 Make sure that this rule appear after you includes bootstrap-responsive.css 在包含bootstrap-responsive.css之后,请确保显示此规则

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM