更改 div 中的弹性订单?
Change flex order in div?
我正在尝试使用 flex-col,其中图像先出现。但是,下面的代码只会在 flex 方向为行时更改顺序(左图)。它不适用于行。
</head>
<body>
<div class="flex-row">
<div class="order-2">
<h1>Flying Kites</h1>
<h2>Subheader</h2>
</div>
<img class="order-1" src="/examples/images/kites.jpg" alt="Flying Kites">
</div>
</body>
</html>
为了让 类 order-x
起作用,父元素需要是 flex
:
<div class="flex">
<div class="order-2">
<h1>Flying Kites</h1>
<h2>Subheader</h2>
</div>
<img class="order-1" src="/examples/images/kites.jpg" alt="Flying Kites">
</div>
为了灵活 div,父 class 必须 'flex' 才能工作。
我正在尝试使用 flex-col,其中图像先出现。但是,下面的代码只会在 flex 方向为行时更改顺序(左图)。它不适用于行。
</head>
<body>
<div class="flex-row">
<div class="order-2">
<h1>Flying Kites</h1>
<h2>Subheader</h2>
</div>
<img class="order-1" src="/examples/images/kites.jpg" alt="Flying Kites">
</div>
</body>
</html>
为了让 类 order-x
起作用,父元素需要是 flex
:
<div class="flex">
<div class="order-2">
<h1>Flying Kites</h1>
<h2>Subheader</h2>
</div>
<img class="order-1" src="/examples/images/kites.jpg" alt="Flying Kites">
</div>
为了灵活 div,父 class 必须 'flex' 才能工作。