我在一个页面上工作,我必须将描述框(此处命名为block2)分成四组,并在每行显示其中的两个。我在block2中添加了display:inline;标记,但是每个块仍然显示在一个新行上。如果有人能帮助我,我将非常感激。谢谢
这是我的密码,

.block2{
    width:auto;
    float:left;
    display:inline;
    background-color:#ECECEC;
    padding:17px 13px 21px 22px;
    margin:6px 6px 0 0;
    color:#636363
}
.block2 p{
    width:462px;
    height:400px;  <!-- Height of the box containing details(one for all) -->
    float:left;
    padding:19px 0 13px 16px;
}
.block2 p img{
float:left;
margin:0 10px 7px 0
}

下面是它的HTML,
        <div class="block2">

                Provide here the details about first member

        </div>

    <div class="block2">

            Member 2's details
        </div>

<div class="block2">



            Member 3's details

    </div>

<div class="block2">

            Member 4's details

    </div>

最佳答案

它似乎是一个简单的填充问题,宽度导致它溢出。很高兴我帮了忙!

09-25 21:50