2011-05-16 48 views
0

我有一個CSS問題與jQuery/jQuery用戶界面/自動完成jQuery用戶界面自動完成佈局/ CSS

<script type="text/javascript"> 
    $(function() { 
    $("#search").autocomplete({ 
    source: "autocomplete.php", 
    minLength: 2, 
    select: function(event, ui) { 
     window.location.href = "http://site.com/" + ui.item.id + ".html"; 
     $("#search").val(ui.item.label); 
    } 
    }) 

    .data("autocomplete")._renderItem = function (ul, item) { 
     return $('<li class="ui-menu-item-with-icon"></li>') 
     .data("item.autocomplete", item) 
     .append('<a style="height: 50px;" class="ui-corner-all"><img src="thumb.php?img=' + item.img + '" class="ajaxsearchimage">' + item.label + '</a>') 
     .appendTo(ul); 
    }; 
    }); 
    </script> 
    <style> 
    span.searchicon 
    { 
     display: inline-block; 
     height: 50px; 
     width: 50px; 
    } 

    .ajaxsearchtext 
    { 
     padding-left: 60px; 
     display: inline-block; 
    } 
    </style> 

我想對齊頂部 我tryed把垂直對齊文本:在頂部班,但它不工作。

http://imageshack.us/photo/my-images/4/sansrer.png/

是否有人有辦法解決嗎?

問候

回答

1

你需要的屬性應用到圖像

img {vertical-align:text-top;} 

爲例 http://www.w3schools.com/css/tryit.asp?filename=trycss_vertical-align

UPDATE

根據意見,我建議像浮出左邊將是解決方案。

img.SelectedClass { float: left; } 
+0

如果我看的是正確的東西,當我將鼠標懸停在內容上時,字體重量變爲正常,字符串適合行。給我一分鐘來思考這個問題。一個直接的解決方案是將字體大小縮小一點,或將字體重量更改爲正常,但如果描述比其他位置更長,則不能解決問題。 – matchew 2011-05-17 18:31:45

+0

好吧,在圖像上而不是vertical-align:text-top,將它改爲float:left – matchew 2011-05-17 18:32:51

+0

它的工作原理。非常感謝 – 2011-05-17 19:05:21

相關問題