我有一系列元素,最后一个有css“float:left”.
我想将它显示在第一个元素的相同高度而不是列表的底部. (我无法更改HTML代码,因此它是列表中的最后一个).
与此同时,我想保持在右边.我怎么能用CSS做到这一点?
谢谢
码:
<div class="field field-type-text field-field-year"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Year: </div> 2009 </div> </div> </div> <div class="field field-type-text field-field-where"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Where: </div> Musée Rath,Geneva </div> </div> </div> <div class="field field-type-text field-field-when"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> When: </div> 25.8 – 27.9.2009 </div> </div> </div> <div class="field field-type-text field-field-editor"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Editor: </div> Blabla Blabla </div> </div> </div> <div class="field field-type-text field-field-material"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Material/techniques: </div> contemporary art installations </div> </div> </div> <div class="field field-type-text field-field-dimension"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Dimension: </div> 2 floors in a neoclassical building </div> </div> </div> <div class="field field-type-text field-field-artists"> <div class="field-items"> <div class="field-item odd"> <div class="field-label-inline-first"> Artists: </div> Blablablabla balbalbalbalba </div> </div> </div> .field-field-year,.field-field-where,.field-field-when,.field-field-editor,.field-field-material,.field-field-dimension { width:300px; } .field-field-artists { width:400px; float:right; clear:right; top-margin: -200px; }
解决方法
你有一个小错误,使它:
.field-field-artists { width:400px; float:right; clear:right; margin-top: -200px; }