Swap elements using CSS?

前端 未结 6 894
醉酒成梦
醉酒成梦 2021-01-18 16:36

I have fairly simple layout, like this:

1
2
6条回答
  •  无人共我
    2021-01-18 17:34

    The first thought is to use absolute positioning within .card.

    .card      { width:100px; height:50px; position:relative; }
      .attack  { width:100px; height:25px; position:absolute; top:25px; }
      .defense { width:100px; height:25px; position:absolute; top:0; }
    

    In this example, .attack will be (visually) below .defense. But note, if you disable CSS, the true arrangement will be seen.

提交回复
热议问题