css - jquerymobile 缩略图垂直对齐与长描述

标签 css jquery-mobile

我应该怎么做才能使 ListView 中的缩略图垂直对齐?
ListView 项是从数据库动态生成的,因此列表项的高度会有所不同,因此在 css 中添加(填充/边距)top 属性是不可能的。

这是我的示例代码:

<ul>
<li><img src='The Thumbnail Image' /><h3>the list heading</h3><p>Long description here (white-space: normal)</p></li>
<li><img src='The Thumbnail Image' /><h3>the list heading</h3><p>Longer description here (white-space: normal)</p></li>
<li><img src='The Thumbnail Image' /><h3>the list heading</h3><p>Longest description here (white-space: normal)</p></li>
</ul>

也许这会让我的案例更清楚:http://jsfiddle.net/QdatL/


非常感谢任何帮助。

最好的问候,
阿尔文。

最佳答案

我添加了这段代码:

li {
   position: relative;   
}

img {
   position: absolute;
   top: 50%;
   left: 5px;
   margin-top: -40px; /* image height/2 */
}

成功了!

DEMO

关于css - jquerymobile 缩略图垂直对齐与长描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14930695/

相关文章:

javascript - PhoneGap (Cordova) 应用程序在加载谷歌图表 API 时崩溃

javascript - 使用切换类时,如何一次只使一个 div 切换?

jQuery-Mobile:多页模板加载但已死

jquery-mobile - 如何删除 jQuery Mobile RC2 中 URL 中的历史记录?

html - 当其上方和下方的 div 改变大小时居中 div

jquery - 如何在 jQuery Mobile 中以编程方式切换导航栏选项卡?

javascript - Leaflet map 需要刷新页面才能在 Jquery Mobile 应用程序中显示

javascript - 如何在没有标签的地方添加标签?

html - Bootstrap 3.3.4 导航栏问题 - 定位

html - 在右下角放置图像