Quantcast
Channel: CSSタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8944

【css】【flexbox】レイアウト3分割

$
0
0

※自分用メモです

① 3等分レイアウト(marginなし)

スクリーンショット 2020-09-06 19.42.13.png
スクリーンショット 2020-09-06 19.42.25.png

<!-- ### sampleSection --><sectionid="sampleSection"class="sampleSection sectionPadding"><divclass="inner"><divclass="headingWrapper"><h2class="sectionHeading colorBlack">3等分レイアウト</h2><pclass="subHeading colorBlack">3等分レイアウト</p></div><divclass="sampleWrapper flexWrapper bg-info"><divclass="sampleItem trisectionItem_noGutter bg-primary"><pclass="test01">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem_noGutter bg-secondary"><pclass="test02">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem_noGutter bg-success"><pclass="test03">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div></div></div></section><!--End sampleSection -->
.trisectionItem{width:calc(100%/3);@includemq('sp_lg'){width:100%;&:last-of-type{margin-bottom:0px;}}@includemq('sp_sm'){width:100%;&:last-of-type{margin-bottom:0px;}}}.sampleItem{padding:20px;}

② 3等分レイアウト(margin均等)

スクリーンショット 2020-09-06 19.44.58.png
スクリーンショット 2020-09-06 19.45.12.png

<!-- ### sampleSection --><sectionid="sampleSection"class="sampleSection sectionPadding"><divclass="inner"><divclass="headingWrapper"><h2class="sectionHeading colorBlack">3等分レイアウト</h2><pclass="subHeading colorBlack">3等分レイアウト</p></div><divclass="sampleWrapper flexWrapper bg-info"><divclass="sampleItem trisectionItem bg-primary"><pclass="test01">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-secondary"><pclass="test02">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-success"><pclass="test03">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div></div></div></section><!--End sampleSection -->
.sampleWrapper.trisectionItem{width:calc((100%-200px)/3);margin-right:calc(200px/2);margin-bottom:40px;&:nth-of-type(3n){margin-right:0;}@includemq('sp_lg'){width:100%;margin-right:0;margin-bottom:40px;&:last-of-type{margin-bottom:0px;}}@includemq('sp_sm'){width:100%;margin-right:0;margin-bottom:40px;&:last-of-type{margin-bottom:0px;}}}.sampleItem{padding:20px;}

③ 3等分レイアウト(margin均等+アイテム間に線)

スクリーンショット 2020-09-06 19.54.06.png
スクリーンショット 2020-09-06 20.02.50.png

<!-- ### sampleSection --><sectionid="sampleSection"class="sampleSection sectionPadding"><divclass="inner"><divclass="headingWrapper"><h2class="sectionHeading colorBlack">3等分レイアウト</h2><pclass="subHeading colorBlack">3等分レイアウト</p></div><divclass="sampleWrapper flexWrapper bg-info"><divclass="sampleItem trisectionItem line_between bg-primary"><pclass="test01">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-secondary"><pclass="test02">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-success"><pclass="test03">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-primary"><pclass="test01">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-secondary"><pclass="test02">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-success"><pclass="test03">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div></div></div></section><!--End sampleSection -->
.sampleWrapper.trisectionItem{width:calc((100%-300px)/3);margin-right:calc(300px/2);margin-bottom:50px;&:nth-of-type(3n){margin-right:0;}@includemq('tab_sm'){width:100%;margin-right:0;margin-bottom:50px;&:last-of-type{margin-bottom:0px;}}@includemq('sp_lg'){width:100%;margin-right:0;margin-bottom:50px;&:last-of-type{margin-bottom:0px;}}@includemq('sp_sm'){width:100%;margin-right:0;margin-bottom:50px;&:last-of-type{margin-bottom:0px;}}}.sampleItem.line_between{position:relative;&:after{content:"";position:absolute;display:block;top:38%;//少し上下調整right:calc(-150px/2);height:40px;width:2px;background-color:red;}//3番目は非表示&:nth-of-type(3n){&:after{content:none;}}//ipad以下サイズでは非表示@includemq('tab_sp'){&:after{content:none;}}@includemq('sp_lg'){&:after{content:none;}}@includemq('sp_sm'){&:after{content:none;}}}.sampleItem{padding:20px;}

④ 3等分レイアウト PC3列 タブレット2列スマホ1列 (margin均等)

スクリーンショット 2020-09-06 20.10.25.png
スクリーンショット 2020-09-06 20.10.45.png
スクリーンショット 2020-09-06 20.10.53.png

<!-- ### sampleSection --><sectionid="sampleSection"class="sampleSection sectionPadding"><divclass="inner"><divclass="headingWrapper"><h2class="sectionHeading colorBlack">3等分レイアウト</h2><pclass="subHeading colorBlack">3等分レイアウト</p></div><divclass="sampleWrapper flexWrapper bg-info"><divclass="sampleItem trisectionItem line_between bg-primary"><pclass="test01">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-secondary"><pclass="test02">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-success"><pclass="test03">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-primary"><pclass="test04">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-secondary"><pclass="test05">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-success"><pclass="test06">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-primary"><pclass="test07">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-secondary"><pclass="test08">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-success"><pclass="test09">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-primary"><pclass="test10">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-secondary"><pclass="test11">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem line_between bg-success"><pclass="test12">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div></div></div></section><!--End sampleSection -->
.sampleWrapper.trisectionItem{//PCは3列表示width:calc((100%-300px)/3);margin-right:calc(300px/2);margin-bottom:50px;&:nth-of-type(3n){margin-right:0;}//タブレットでは2列表示@includemq('tab_sm'){width:calc((100%-100px)/2);margin-right:100px;margin-bottom:50px;&:nth-of-type(2n){margin-right:0;}&:nth-of-type(3n){margin-right:100px;}&:nth-of-type(6n){margin-right:0;}}//スマホでは1列表示@includemq('sp_lg'){width:100%;margin-right:0;margin-bottom:50px;&:last-of-type{margin-bottom:0px;}}@includemq('sp_sm'){width:100%;margin-right:0;margin-bottom:50px;&:last-of-type{margin-bottom:0px;}}}.sampleItem{padding:20px;}

⑤ 3等分レイアウト PC3列 タブレット2列スマホ2列 (margin均等)

スクリーンショット 2020-09-06 20.25.37.png
スクリーンショット 2020-09-06 20.25.44.png
スクリーンショット 2020-09-06 20.25.53.png

<!-- ### sampleSection --><sectionid="sampleSection"class="sampleSection sectionPadding"><divclass="inner"><divclass="headingWrapper"><h2class="sectionHeading colorBlack">3等分レイアウト</h2><pclass="subHeading colorBlack">3等分レイアウト</p></div><divclass="sampleWrapper flexWrapper bg-info"><divclass="sampleItem trisectionItem bg-primary"><pclass="test01">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-secondary"><pclass="test02">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-success"><pclass="test03">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-primary"><pclass="test04">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-secondary"><pclass="test05">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div><divclass="sampleItem trisectionItem bg-success"><pclass="test06">テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                    テキストテキストテキストテキストテキストテキスト
                </p></div></div></div></section><!--End sampleSection -->
.sampleWrapper.trisectionItem{width:calc((100%-100px)/3);margin-right:calc(100px/2);margin-bottom:30px;&:nth-of-type(3n){margin-right:0;}//タブレットは2列@includemq('tab_sm'){width:calc((100%-100px)/2);margin-right:100px;margin-bottom:30px;&:nth-of-type(2n){margin-right:0;}&:nth-of-type(3n){margin-right:100px;}&:nth-of-type(6n){margin-right:0;}}//スマホも2列@includemq('sp_lg'){width:calc((100%-40px)/2);margin-right:40px;//アイテム間隔調整margin-bottom:30px;&:nth-of-type(2n){margin-right:0;}&:nth-of-type(3n){margin-right:40px;//アイテム間隔調整}&:nth-of-type(6n){margin-right:0;}}@includemq('sp_sm'){width:calc((100%-40px)/2);margin-right:40px;//アイテム間隔調整margin-bottom:30px;&:nth-of-type(2n){margin-right:0;}&:nth-of-type(3n){margin-right:40px;//アイテム間隔調整}&:nth-of-type(6n){margin-right:0;}}}.sampleItem{padding:20px;}

Viewing all articles
Browse latest Browse all 8944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>