我正在使用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