久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

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

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

瀏覽:108日期: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)文章:
主站蜘蛛池模板: 甘谷县| 达拉特旗| 东源县| 桐乡市| 微山县| 民县| 胶州市| 法库县| 安平县| 蕉岭县| 马鞍山市| 汽车| 神木县| 苏尼特左旗| 彭山县| 赞皇县| 濮阳县| 金堂县| 阿合奇县| 晋宁县| 麦盖提县| 武乡县| 娄底市| 定日县| 拜城县| 内丘县| 尼勒克县| 桃园市| 达尔| 平武县| 芒康县| 马边| 渝中区| 古交市| 沿河| 信宜市| 繁峙县| 通州区| 翁源县| 无为县| 灵台县|