LoginSignup
0
0

More than 3 years have passed since last update.

3カラムレイアウト作成

Posted at

3カラムレイアウト作成

・可変レイアウト部分をflex: 1にし、残りのレイアウトを固定幅にすればok

.parent {
    display: flex;
    height: 100vh;
}

.fix {
    width: 300px;
    background-color: violet;
}

.content {
    flex: 1;
    background-color: aqua;
}
import React from 'react'
import './Column2Layout.css'

export const Column2Layout = () => {
    return (
        <div className="parent">
            <div className="fix"></div>
            <div className="content"></div>
            <div className="fix"></div>
        </div>
    )
}

スクリーンショット 2020-11-17 23.07.52.png

縦に3カラムレイアウトするには、親要素で子の整列方向を指定する。(flex-direction: column;)

.parent {
    display: flex;
    height: 100vh;
    flex-direction: column;
}

.menu {
    height: 300px;
    background-color: violet;
}

.content {
    flex: 1;
    background-color: aqua;
}

スクリーンショット 2020-11-17 23.09.06.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0