我正在使用jQuery手机,并试图将一些图像图标集中在列表中。我遇到的问题是图像不是在列表项中垂直居中。如何在LI元素中垂直居中放置图像?
有人能指点我,因为我不是一个CSS专家。我知道我可以让他们用桌子,但我不想这样做。谢谢。
哦,我在下面的m代码中使用EJS。请参阅下面的屏幕截图:
这里是我的代码:
<li data-icon="false">
<a href="#">
<img src="images/img_trans.gif" class='largePlatform platform_<%= releases[i].platform_abbr %>_large' width='30' height='30' style="position:absolute; top:25%; left:10px"/>
<h2 style="position:absolute; top:25%; left:50px"><%= releases[i].platform_abbr %></h2>
<div data-role="controlgroup" data-type="horizontal" style="float:right" >
<% if (purchaseText != "") { %>
<img src="images/game_detail/<%= releases[i].purchase_button_icon %>-purchase.png" width="35" height="35" onclick="window.open('<%= releases[i].purchase_button_url %>');" alt="<%= purchaseText %>" style="position:relative; top:10px;"/>
<% } %>
<div data-role="button" data-icon="reminder" data-theme="<%= buttonTheme %>" onclick="<%= buttonAction %>(<%= releases[i].id %>)">
<%= buttonText %>
</div>
</div>
</a>
</li>
T他的回答将取决于图像如何针对里面的其他*内容展开。你可以精心策划吗? – Faust 2012-02-29 13:34:47
肯定的事情。所以我的li元素有3个并排的图像在顶部垂直对齐。所以像[img some text img img] – jini 2012-02-29 13:39:22
对不起 - 你能否澄清你的意思是“......垂直对齐在顶部。” – Faust 2012-02-29 13:56:35