对齐与CSS不一致

时间:2013-10-01 14:56:36

标签: html css

我正在做一个评论页面,但是现在我遇到的问题是泡泡语言的对齐方式没有错位。

实施例

enter image description here

我想这可以用CSS修复,但不太确定。 我在这里有我的演示http://jsfiddle.net/bSaJc/

提前致谢

这是我的css

.bubble-panel {
    display: inline-block;
    //border: 1px dotted #CCCCCC;
    height: 250px;
    position: relative;
    margin: 20px;
}


.bubble 
{
position: relative;
width: 535px;
height: 130px;
padding: 4px;
background: #FFFFFF;
-webkit-border-radius: 31px;
-moz-border-radius: 31px;
border-radius: 31px;
border: #46A5E4 solid 9px;
display:inline-block;
margin-bottom: 0px;
margin-right: 50px;

}

.bubble p
{
    margin: 10px;
}

.bubble:after 
{
content: '';
position: absolute;
border-style: solid;
border-width: 31px 14px 0;
border-color: #FFFFFF transparent;
display: block;
width: 0;
z-index: 1;
margin-left: -14px;
bottom: -31px;
left: 20%;
}

.bubble:before 
{
content: '';
position: absolute;
border-style: solid;
border-width: 39px 22px 0;
border-color: #46A5E4 transparent;
display: block;
width: 0;
z-index: 0;
margin-left: -22px;
bottom: -48px;
left: 20%;
}
.caption {
    //border: 1px solid red;
    width: 20em;
    font-size: 14px;
    line-height: 1.5;
    position: absolute;
    bottom: 15px;
    right: 50px;
}
.caption h1, .caption h2, .caption h3 {
    font-size: 1.00em;
    text-align: left;
    margin: 0;

}

3 个答案:

答案 0 :(得分:1)

这就是你想要的吗?

http://jsfiddle.net/cfknoop/bSaJc/1/

vertical-align:top;

答案 1 :(得分:1)

请参阅此DEMO

我添加了vertical-align: middle;

.bubble {
   position: relative;
   width: 535px;
   height: 130px;
   padding: 4px;
   background: #FFFFFF;
   -webkit-border-radius: 31px;
   -moz-border-radius: 31px;
   border-radius: 31px;
   border: #46A5E4 solid 9px;
   display:inline-block;
   margin-bottom: 0px;
   margin-right: 50px;
   vertical-align: middle; /* ADD THIS LINE */

}

答案 2 :(得分:0)

float:left添加到.bubble-panel

.bubble-panel {
display: inline-block;
float: left;
height: 250px;
position: relative;
margin: 20px;
}

DEMO