Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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 具有固定标题/标题的内联div_Html_Css - Fatal编程技术网

Html 具有固定标题/标题的内联div

Html 具有固定标题/标题的内联div,html,css,Html,Css,我有这个CSS代码: .homeBoxes { width: 49%; display:inline; float:left; overflow-y:scroll; min-height:300px; max-height:350px; margin-right:5px; margin-left:5px; margin-top:10px; margin-bottom:10px; } .title { marg

我有这个CSS代码:

.homeBoxes {
    width: 49%;
    display:inline;
    float:left;
    overflow-y:scroll;
    min-height:300px;
    max-height:350px;
    margin-right:5px;
    margin-left:5px;
    margin-top:10px;
    margin-bottom:10px;
}
.title {
    margin:0 auto 0 auto;
    padding:2px;
    font-size:20px;
    background-color:#f36f25;
}
我希望标题固定在
.homeboxs
div和100%内(不显示标题右侧的滚动条)

仅在div中固定,而不是在整个页面上


你可以这样做:

HTML:

<div class="homeBoxes_container">
    <div class="title">Title</div>
    <div class="homeBoxes">TEXT</div>
</div>
.homeBoxes_container {
    clear:both;
    width: 49%;
     min-height:300px;
    max-height:350px;
}
.homeBoxes {
    width:100%;
    display:inline;
    float:left;
    overflow-y:scroll;   
    margin-right:5px;
    margin-left:5px;
    margin-top:10px;
    margin-bottom:10px;
     min-height:300px;
    max-height:350px;
}

设置溢出属性

.homeBoxes 
{
 width: 49%;
 display:inline;
 float:left;
 overflow-y:scroll;
 min-height:300px;
 max-height:350px;
 margin-right:5px;
 margin-left:5px;
 margin-top:10px;
 margin-bottom:10px;
 overflow: hidden;
}

如果要滚动到内容,请指定溢出:自动或滚动。

溢出:隐藏;试试这个。。您已经给出了最小高度和最大高度。看看那个。。我在哪里可以试试?看看我的编辑,找到了!:)非常好,谢谢!