在CSS或javascript中更改div顺序 [英] Change div order in CSS or javascript

查看:378
本文介绍了在CSS或javascript中更改div顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我的布局如此:

<div id="main">            
    <div id="NormalContent">
        {some content which is a fixed length list}
    </div>
    <div id="FeaturedContent">
        {some content which may contain a long list}
    </div>
</div>

,我想将FeaturedContent置于NormalContent之上。

and I want to place FeaturedContent above NormalContent.

我可以用CSS吗?

推荐答案

在Javascript中,您可以简单地在页面上重新排序。

In Javascript you could simply reorder them on the page.

对于CSS,如果它们并排(有些条件),但是没有一个在另一个之上,则可以左右交换它们。

With CSS it would be possible to swap them left and right if they were side by side (with some conditions), but not one above the other.

这篇关于在CSS或javascript中更改div顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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