与inline-block(其他元素向下推)错位 [英] Missalignment with inline-block (other elements pushed down)
本文介绍了与inline-block(其他元素向下推)错位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在一行中对齐小方框。这些盒子每个都有2个元素。在某些情况下,第一个元素是如此多的文本,它分为两行。如果发生这种情况,此特殊行中的所有其他块都显示如下。
I'm trying to align small boxes in a row. These boxes have something like 2 elements in each. In some cases, the first element is so "much" text, that it splits into 2 lines. If this happens, all other blocks in this special line are shown below.
长故事短,下面是示例:
http://jsfiddle.net/PMRQ5/
Long story short, here is the example: http://jsfiddle.net/PMRQ5/
如果您调整HTML的大小字段,你可以看到我的意思。有人可以帮助吗?
If you resize the HTML field, you can see what I mean. Can somebody help?
.songlist .even {
background: #c2e4fa;
background: -moz-linear-gradient(top, #d9eefc, #c2e4fa);
margin-right: 5px;
}
.songlist .odd {
background: #faf4c2;
background: -moz-linear-gradient(top, #fcf8d9, #faf4c2);
margin-right: 5px;
}
.songlist .itemBox {
font-size: 11px;
width: 220px;
min-height: 100px;
clear: both;
padding: 5px;
margin: 5px 10px 5px 10px;
display: inline-block;
position: relative;
border-radius: 4px;
}
.songlist .itemBox .title {
font-weight: bold;
font-size: 16px;
}
.songlist .itemBox .artist {
clear: left;
font-size: 11px;
}
.songlist .itemBox .titlerating {
bottom: 10px;
left: 10px;
position: absolute;
}
.songlist .itemBox .dance {
bottom: 5px;
right: 10px;
position: absolute;
}
<div class='songlist'>
<div class='itemBox even'>
<div class='cover'></div>
<div class='title'>You and you</div>
<div class='artist'>101 Strings Orchestra</div>
<div class='clear'></div>
</div>
<div class='itemBox odd'>
<div class='title'>The Queen's lace hankerchief waltz</div>
<div class='artist'>101 Strings Orchestra</div>
<div class='clear'></div>
</div>
<div class='itemBox even'>
<div class='cover'></div>
<div class='title'>Voices of spring</div>
<div class='artist'>101 Strings Orchestra</div>
<div class='clear'></div>
</div>
<div class='itemBox odd'>
<div class='cover'></div>
<div class='title'>Roses from the south</div>
<div class='artist'>101 Strings Orchestra</div>
<div class='clear'></div>
</div>
</div>
推荐答案
添加 vertical-align:top
或 vertical-align:bottom
你想要什么。
这篇关于与inline-block(其他元素向下推)错位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文