2011-05-16 45 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

相关问题