我有以下代码,其中两个 Section 块垂直跟随,我希望它们水平对齐。为此,我将它们的属性 inline-block 放在我的 CSS 的 position 参数中,但它不起作用。
这是我的代码:
HTML
<section class="desc-block-left">
<img class="icon"src="img/scolarite.png" alt="Scolarité">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem, quos, perspiciatis reiciendis explicabo possimus vel culpa fugiat voluptatum laboriosam hic adipisci dicta itaque sed ipsum assumenda! Alias voluptatum blanditiis beatae?
</p>
<ul>
<li><img src="img/tools-info2.png" alt="Info"></li>
<li><img src="img/tools-fav2.png" alt="Fav"></li>
</ul>
</section>
<section class="desc-block-right">
<img class="icon"src="img/scolarite.png" alt="Scolarité">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem, quos, perspiciatis reiciendis explicabo possimus vel culpa fugiat voluptatum laboriosam hic adipisci dicta itaque sed ipsum assumenda! Alias voluptatum blanditiis beatae?
</p>
<ul>
<li><img src="img/tools-info2.png" alt="Info"></li>
<li><img src="img/tools-fav2.png" alt="Fav"></li>
</ul>
</section>
CSS
/*LAYOUT LEFT COLUMN*/
.desc-block-left{
position:inline-block;
border-style:solid;
background-color:#ffffff;
width:40%;
height:110px;
margin:30px 10px 100px 150px;
border-radius:10px;
}
.icon{
float:left;
margin:5px;
}
.desc-block-left p{
position:inline-block;
float:left;
margin:5px;
width:70%;
text-align:justify;
}
.desc-block-left ul{
display:inline-block;
}
.desc-block-left ul li{
position:inline;
margin:10 5 10 5;
list-style:none;
}
/*LAYOUT RIGHT COLUMN*/
.desc-block-right{
position:inline-block;
border-style:solid;
background-color:#ffffff;
width:40%;
height:110px;
margin:30px 10px 100px 150px;
border-radius:10px;
}
.desc-block-right p{
position:inline-block;
float:left;
margin:5px;
width:70%;
text-align:justify;
}
.desc-block-right ul{
display:inline-block;
}
.desc-block-right ul li{
position:inline;
margin:10 5 10 5;
list-style:none;
}