本文介绍了CSS vertical-align中间一个inline-block的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定在我的布局中使用inline-block,但我有问题
在垂直中间位置(pan2)放置一个块

I decided to use the inline-block for my layout, but I have problemsto place a block in the vertical middle position (pan2)

<div id="container">
<div class="row">
    <div class="pan1">
        <div class="content">
          LEFT PANEL 
          <br /><br />
          <br /><br />
          <br /><br />
         </div>
    </div><div class="pan2">
        <div class="content">
           RIGHT PANEL <br/>
        </div>
    </div>
</div>
</div>

CSS

body { 
font-family: Arial, Helvetica, sans-serif; 
font-size: 12px; 
background-color: #f5f6f7; 
} 

#container { 
width: 600px; 
margin-left: auto; 
margin-right: auto;
background: #ccc;
} 

.row { 
margin-top: 10px; 
background: #fff; 
padding: 0px;
border: 1px solid #000;
} 

.pan1  { 
width: 300px;
display: inline-block;
vertical-align: top;
*zoom: 1;
*display: inline;
padding: 0px;
border: 1ps solid #000;
background: #999;
} 

.pan2  { 
width: 200px;
display: inline-block;
vertical-align: middle;
*zoom: 1;
*display: inline;
padding: 0px;
background: #ccc;
} 

.content {
padding: 0px;
border: 1px solid #000;
font-size: 12px;
}



我尝试设置 vertical-align:middle 在pan2块,但这仍然在顶部。我如何使用display inline-block?感谢

I tried to set vertical-align: middle in pan2 block but this remains at the top. How could I make using the display inline-block? thanks

推荐答案

更改 vertical-align pan1

.pan1 {
   vertical-align:middle;
}

这篇关于CSS vertical-align中间一个inline-block的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 11:17