Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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 如何获得相等的内容和边栏(高度)?_Html_Css - Fatal编程技术网

Html 如何获得相等的内容和边栏(高度)?

Html 如何获得相等的内容和边栏(高度)?,html,css,Html,Css,好的,我使用引导,我有主要内容,在主要内容中,我有左侧和右侧。左边是它的内容,右边是8个盒子。我什么都试过了,但我的左右两边都不相等 .main-content{ float: left; width: 100%; position: relative; } .main-content .right-box.col-md-4{ width: 37.5%; padding-left:0; padding-right:0; float:ri

好的,我使用引导,我有主要内容,在主要内容中,我有左侧和右侧。左边是它的内容,右边是8个盒子。我什么都试过了,但我的左右两边都不相等

.main-content{
    float: left;
    width: 100%;
    position: relative;


}
.main-content .right-box.col-md-4{
    width: 37.5%;
    padding-left:0;
    padding-right:0;
    float:right;
    position:absolute;  
    top:0;
    bottom:0;
    right: 0;

}
.main-content .left-box.col-md-8{
    width:62.5%;
    padding-left:0;
    padding-right: 0;
    background-color: #fff;
    float: left;
    position: relative;

}
小提琴: 右侧的最后一个div必须和左侧的div一样高。。
我尝试过这个方法,但没有成功。

高度是一个在Bootstrap驱动的网站中不应该强制使用的元素,因为Bootstrap依赖于它的垂直灵活性来响应较小的设备。毕竟,这就是为什么有人会使用引导的主要目的。然而,如果你坚持的话,那么你必须给每个元素一个确定的高度,并用填充物控制这样的高度

你没有提供我们可以使用的代码(甚至连小提琴都没有),所以我将发布我的演示,这样你就可以看到实现这一点所需的引导类体系结构

这是HTML文件

<div class="container">
    <div class="row main-content">
        <div class="col-xs-12 col-sm-6 col-md-6">
            <div class="row">
                <div class="box left">

                </div>  
            </div>
        </div>
        <div class="col-xs-12 col-sm-6 col-md-6">
            <div class="row">
                <div class="box right">
                    <div class=" innerbox col-xs-12">
                        1
                    </div>
                    <div class=" innerbox col-xs-12">
                        2
                    </div>      
                    <div class=" innerbox col-xs-12">
                        3
                    </div>  
                    <div class=" innerbox col-xs-12">
                        4
                    </div>  
                    <div class=" innerbox col-xs-12">
                        5
                    </div>  
                    <div class=" innerbox col-xs-12">
                        6
                    </div>  
                    <div class=" innerbox col-xs-12">
                        7
                    </div>  
                    <div class=" innerbox col-xs-12">
                        8
                    </div>  
                </div>
            </div>  
        </div>
    </div>
</div>

还有

的链接,你也可以发布HTML吗?当然可以……我会发布的now@TimTroiano我试图发布它,但它太长了。。。它的长度超过30000个字符…@无需创建小提琴。好的…我会这样做:)我无法确定高度,因为我将有不同大小的内容,正如我在开头一段中所说的。你只需要习惯高度必须是灵活的,但这不能解决我的问题,因为你没有问题。引导应该是这样的。你需要相对的高度。从我的演示中去掉高度,这就是你应该拥有的。我将尝试找到其他解决方案
.box.left{
    background:red;
    text-align:center;
    color: white;
    height:350px;
}
.box.right{
    background:blue;
    text-align:center;
    color: white;
    height:350px;
    padding:10px
}

.innerbox{
    background:lightgray;
    text-align:center;
    color: black;
    height:30px;
    margin-top:10px;
}

.main-content{
    float: left;
    width: 100%;
    position: relative;
}