CSS布局,使用CSS重新排序DIV [英] CSS layout, use CSS to reorder DIVs

查看:277
本文介绍了CSS布局,使用CSS重新排序DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于HTML

<div>
   <div id="content1"> content 1</div>
   <div id="content2"> content 2</div>
   <div id="content3"> content 3</div>
</div>

呈现为

content 1
content 2
content 3

有没有办法使用CSS而不改变HTML部分来渲染它。

Is there a way to render it as below by using CSS only without changing the HTML part.

content 1
content 3
content 2


推荐答案

它可能不完全符合您的要求,但请看看这个问题:

CSS定位div在另一个div上面, a>

It might not exactly match what you're after, but take a look at this question:
CSS positioning div above another div when not in that order in the HTML

基本上,你必须使用Javascript来以任何方式可靠。

Basically, you'd have to use Javascript for it to be reliable in any way.

这篇关于CSS布局,使用CSS重新排序DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆