开发者

CSS: move a "float:right" element to top (to align with the first element of the list)

开发者 https://www.devze.com 2022-12-27 18:04 出处:网络
I\'ve a sequence ofelements and the last one has css \"float:left\". I would like to display it at the same height of the first element and not on the bottom of the list. (I cannot change the html co

I've a sequence of elements and the last one has css "float:left".

I would like to display it at the same height of the first element and not on the bottom of the list. (I cannot change the html code, so it is the last in the list).

At the same time, I would like to keep it on the right. How can I make it wich CSS ?

thanks

Code:

 <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:&nbsp;</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:&nbsp;</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:&nbsp;</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:&nbsp;</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:&nbsp;</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:&nbsp;</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:&nbsp;</div>
                    Blablablabla balbalbalbalba
        </div>
        </div>
</div>


    .field-field开发者_StackOverflow社区-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;
    }


you have a small error, make it:

.field-field-artists { 

        width:400px; 
        float:right; 
        clear:right; 
        margin-top: -200px; 
    } 


You could float the last field to the right and the others to the left (assuming there is enough horizontal space) or use absolute positioning or reorder the blocks with javascript; but since this is apparently Drupal, can't you just reconfigure the field weights?

0

精彩评论

暂无评论...
验证码 换一张
取 消