html - 如何使用媒体查询更改 html 元素的顺序?

标签 html css responsive-design media-queries

This is an example of my code

Display on Desktop

<body>
    <div>
    <header>
        <div>example</div>
        <a><img src"my logo is here"/></a>
        <div>example</div>
        <nav>classic-menu</nav>
    </header>
    </div>
</body>



Display on Mobile

<body>
    <div>
    <nav>menu responsive</nav>-------> when the menu go in drop down all header content follow the menu

    <header>
        <div>example</div>
        <a><img src"my logo is here"/></a>----->wrong logo position when you open the menu responsive
        <div>example</div>
    </header>
    </div>
</body>

我想知道是否可以通过媒体查询更改 HTML 元素的当前顺序,以便在响应式 View 中修复 Logo 位置。

最佳答案

@media only screen and (max-width: 600px) {
    #flex { display: flex; flex-direction: column; }
    #a { order: 2; }
    #b { order: 1; }
    #c { order: 3; }
}
You Can try this:

<div id="container">
   <div id="a">A</div>
   <div id="b">B</div>
   <div id="c">C</div>
</div>

详情:点击here

关于html - 如何使用媒体查询更改 html 元素的顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32891128/

相关文章:

php - 如何使用PHP检查数据库中是否存在用户

jquery - 滚动页面时平滑更改粘性标题和页面内容的填充/边距

css - css中是否有相当于 "initial width"的东西

html - CSS Pie 和 IE 元标记

javascript - 在 javascript 中干燥 html 包装器

javascript - 有一个更好的方法吗? (递归解析 HTML unicode 实体)

html - For循环将图像并排放置

twitter-bootstrap - 在 bootstrap/kickstrap 中使用媒体查询的完全不同的布局

css - 宽度超过 960 像素的响应式设计屏幕

javascript - 检测鼠标按下时单击的元素