HTML float right element order

前端 未结 6 1467
难免孤独
难免孤独 2020-12-02 12:08

If I have three elements flaoted to right, why order is following (see jsfiddle) element 1 is first element on right side, when element 3 is actually last element.

O

6条回答
  •  旧时难觅i
    2020-12-02 12:24

    This is because in your html, you have specified that [element 1] be displayed first aligned to the right. Hence this is exactly what the browser renders. When, in your html, you go on to display [element 2], floated to right, the browser does this BUT AFTER giving [element 1] priority of being displayed to the right as [element 1] came first in your HTML.

    Hope this makes sense.

提交回复
热议问题