Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 高度100%不适用于父div中的子级,最小高度:100%_Html_Css - Fatal编程技术网

Html 高度100%不适用于父div中的子级,最小高度:100%

Html 高度100%不适用于父div中的子级,最小高度:100%,html,css,Html,Css,我试图在父div中扩展子级高度,最小高度为100%,我想根据其中的内容扩展包装器的高度,如果我将最小高度设置为100%,包装器将根据内容进行扩展,但侧边栏和侧边栏会塌陷到其内容的高度,我希望它们大约是父包装总高度的98% 如果我将height:100%设置为parent wrapper,将height:98%设置为children sidebar和sidebar tank,它们会展开,但wrapper不会根据content div中的内容展开,wrapper只会展开到浏览器的高度,不会显示溢出的

我试图在父div中扩展子级高度,最小高度为100%,我想根据其中的内容扩展包装器的高度,如果我将最小高度设置为100%,包装器将根据内容进行扩展,但侧边栏和侧边栏会塌陷到其内容的高度,我希望它们大约是父包装总高度的98%

如果我将height:100%设置为parent wrapper,将height:98%设置为children sidebar和sidebar tank,它们会展开,但wrapper不会根据content div中的内容展开,wrapper只会展开到浏览器的高度,不会显示溢出的内容

HTML:

<body>
    <div class="wrapper">
        <div class="client-dasboard">

            <div class="sidebar">

            </div>

            <div class="sidebar-tanks">

            </div>

            <div class="content>

            </div>
        </div>
    </div>
</body>
body{
    display:block;
    position: relative;
    height:100%;

    .wrapper{
        display: block;
        position: relative;
        height: 100%;
        overflow: hidden;
        width: 1168px;
        margin: 0px auto;
        background: #ececec;

        .sidebar,
        .sidebar-tanks{
            height: 98%;
            display: block;
            float: left;
        }

        .content{
            min-height: 100%;
            height:auto;
        }
    }  
}

问题出在这里:

.sidebar,
.sidebar-tanks {
    height: 98%;
    display: block;
    float: left;
}
使用clear:tware-CSS属性将元素附加到侧边栏的父级,并将float:right(或left)添加到内容中。这可能对你有帮助

但是

如果要在其父div内展开子级高度,请尝试以下技术:。 这与你必须做的事情非常相似。这是另一篇关于这个问题的好文章。它非常有用,而且易于使用

我希望这能帮助您:)

问题是:

.sidebar,
.sidebar-tanks {
    height: 98%;
    display: block;
    float: left;
}
使用clear:tware-CSS属性将元素附加到侧边栏的父级,并将float:right(或left)添加到内容中。这可能对你有帮助

但是

如果要在其父div内展开子级高度,请尝试以下技术:。 这与你必须做的事情非常相似。这是另一篇关于这个问题的好文章。它非常有用,而且易于使用

我希望这能帮助你:)

不,这是所谓的“SASS”。不,这是所谓的“SASS”。