0

我创建了一个小提琴:http: //jsfiddle.net/LgNp5/

如您所见,右侧有一个装载机。左侧有一个内容动态变化的菜单,因此右侧浮动 div 没有固定高度(父元素也没有)。我怎样才能使加载器始终垂直对齐(没有 JS)?

4

1 回答 1

0

如果您垂直居中的元素是固定高度,那么这是最简单的,您可以通过这种方式设置top: 50%;并且 a margin-top: -Zpxwhere`Z是垂直高度的一半。

#ui-tooltip-prompt .dynamo_content {
    float:right;
    width:400px;
    padding-left:8px;
    position:absolute;
    height:16px;
    top:50%;
    margin-top:-8px;    
}
于 2012-09-03T13:30:20.223 回答