0

我有一个主要部门,其中有两个部门

一个是左 DIV,另一个是右 DIV

在这里提琴

HTML 是

<div class="main">

    <div class="left">
        Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. 
    </div>
    <div class="right">
        some text heresome text heresome text heresome text heresome text heresome text heresome text heresome text heresome text here
    </div
    </div>

而 CSS 是

body
{
 background-color:black;   
}
.main
{
    width:80%;
    background-color:White;
    opacity:0.9;
    margin-left:auto;
    margin-right:auto;
    margin-top:25px;
}
.left
{
    width:68%;
    float:left;
    background-color:White;
    padding:2%;
    font-family:Calibri;
}

.right
{
    background-color:White;
    width:26%;
    padding:1%;
    float:right;
}

我希望两个 DIV 必须始终具有相同的高度。无论其中存在多少文本。

现在我的右 DIV 的高度小于左 DIV,就像小提琴一样。

帮我。提前致谢

4

1 回答 1

2

将此添加到 .main

height: 30%;
overflow: auto;

链接:小提琴示例

于 2013-01-25T09:53:07.703 回答