相关疑难解决方法(0)

在flexbox中从纵向切换到横向布局

我想通过flexbox 实现以下布局:

布局

您可以在图片中看到两个方向.纵向视图的左侧和横向视图的右侧.

前提是我希望尽可能缩短我的HTML(如果可能的话).

有没有办法用flex做到这一点?

在纵向视图中,一切正常,因为它只是一列.

现在我被困在横向.

导航应位于屏幕右侧,其他内容位于左侧.

header, footer, main, nav {
  margin: 5px;
  padding: 5px;
  border-radius: 5px;
  min-height: 120px;
  border: 1px solid #eebb55;
  background: #ffeebb;
}
section {
  display: flex;
  flex-direction: column;
}
@media only screen and (orientation: landscape) {
  /* no clue */
}
Run Code Online (Sandbox Code Playgroud)
<section>
  <header>header</header>
  <main>content</main>
  <nav>navigation</nav>
  <footer>footer</footer>
</section>
Run Code Online (Sandbox Code Playgroud)

非常感谢您的宝贵时间!

html css css3 flexbox

3
推荐指数
1
解决办法
1720
查看次数

标签 统计

css ×1

css3 ×1

flexbox ×1

html ×1