国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

css - 使用flex怎么實(shí)現(xiàn)這種布局?

瀏覽:115日期:2022-11-06 14:14:19

問題描述

css - 使用flex怎么實(shí)現(xiàn)這種布局?

使用flex怎么實(shí)現(xiàn)這種布局,我寫到第三個(gè)寫不下去了求大神補(bǔ)充。

<p class='pic'> <p class='pic1'></p> <p class='pic2'></p> <p class='pic3'></p> <p class='pic4'></p></p><style> .pic{display: flex;width: 400px;height: 400px;margin: 100px auto;flex-wrap: wrap; } .pic1{flex: 1;height: 100%;background-color: pink; } .pic2{flex: 1;height: 50%;background: #C81623; } .pic3{/*width: 25%;*//*float: left;*//*height: 50%;*//*background-color: green;*/ } ...

問題解答

回答1:

大概就像下面這樣

<!DOCTYPE html><html><head> <meta charset='utf-8'> <title></title> <style media='screen'>#main { display: flex; height: 500px;}#left { width: 200px; background: red;}#right-box { display: flex; flex-direction: column; background: blue; flex: 1;}#right-top { height: 200px; background: yellow;}#right-bottom-box { display: flex; flex: 1;}#bottom-left { width: 50%; background: pink;}#bottom-right { width: 50%; background: magenta;} </style></head><body> <p id='main'><p id='left'></p><p id='right-box'> <p id='right-top'></p> <p id='right-bottom-box'><p id='bottom-left'></p><p id='bottom-right'></p> </p></p> </p></body></html>

效果css - 使用flex怎么實(shí)現(xiàn)這種布局?

回答2:

.flex-box { display: flex;}.flex-1 { flex: 1;}.flex-2 { flex: 2;}.flex-3 { flex: 3;}

<p class='flex-box'> <p class='flex-2'>pic</p> <p class='flex-3'> <p>pic</p> <p class='flex-box'> <p class='flex-1'>pic</p> <p class='flex-1'>pic</p> </p> </p></p>

標(biāo)簽: CSS
相關(guān)文章:
主站蜘蛛池模板: 阳谷县| 昌黎县| 石林| 什邡市| 富裕县| 达拉特旗| 碌曲县| 凤阳县| 泾川县| 舒城县| 郧西县| 长垣县| 深州市| 泗阳县| 晋城| 三门县| 教育| 神农架林区| 满城县| 调兵山市| 阜城县| 海宁市| 连山| 南汇区| 乌拉特中旗| 望奎县| 鄄城县| 昭平县| 栾城县| 凌源市| 烟台市| 梁平县| 荆门市| 平阳县| 普宁市| 樟树市| 天祝| 什邡市| 平泉县| 江永县| 徐闻县|