課程
/前端開發
/HTML/CSS
/Grid布局基礎
用stylus來寫網格區域,引用的時候,出不來效果,正常的css沒問題,特請教。
2019-04-07
源自:Grid布局基礎 5-4
正在回答
寫成一行程序沒問題,程序正常執行
? ? grid-template-areas "title title header header" "time time swiper swiper" "block1 block2 swiper swiper" "block3 block4 swiper swiper" "block5 block6 swiper swiper" "block7 block7 video info"
但是格式很難看,失去了所見既布局的意思,多行的話,代碼沒有執行? ?
?grid-template-areas "title title header header"
? ? ? ? ? ? ? ? ? ? ? ? ???????????"time time swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block1 block2 swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block3 block4 swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block5 block6 swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block7 block7 video info"
WindBelll
愛米
SuperHulk
SuperHulk 回復 SuperHulk
給你個例子看看,歡迎采納 <!DOCTYPE?html> <html> <head> ?<meta?charset="UTF-8"> ?<title>grid-template-areas</title> ?<style> ?*{ ??margin:0; ??padding:0; ??list-style:none; ?} ?.container{ ??border:1px?solid?#000; ????????width:600px; ????????height:200px; ????????margin:50px?auto; ????????display:grid; ????????/*repeat(repeat,value)函數,只試用于下面兩者*/ ????????grid-template-columns:100px?repeat(2,200px)?100px; ????????grid-template-rows:repeat(2,100px); ????????/*第一行與第二行之間用空格隔開即可,需要用雙引號包裹起來*/ ????????grid-template-areas:"one?area?area?two" ?????????????"three?area?area?four"; ????????/*align-items:center;*/ ????????/*justify-items:center;*/ ????????text-align:center; ????????line-height:100px; ????????/*place-items:center;*/ ?} ?/*相同區域的取同一個名字即可*/ ?.container>div:nth-child(1){ ??background:blue; ??grid-area:one; ?} ?.container>div:nth-child(2){ ??background:#fff; ??grid-area:area; ?} ?.container>div:nth-child(3){ ??background:#fff; ??grid-area:area; ?} ?.container>div:nth-child(4){ ??background:red; ??grid-area:two; ?} ?.container>div:nth-child(5){ ??background:yellow; ??grid-area:three; ?} ?.container>div:nth-child(6){ ??background:#fff; ??grid-area:area; ?} ?.container>div:nth-child(7){ ??background:#fff; ??grid-area:area; ?} ?.container>div:nth-child(8){ ??background:orange; ??grid-area:four; ?} ?</style> </head> <body> ?<div?class="container"> ??<div>1</div> ??<div></div> ??<div></div> ??<div>2</div> ??<div>3</div> ??<div></div> ??<div></div> ??<div>4</div> ?</div> </body> </html>
蘭亭一夢 提問者
舉報
Grid二維網格布局系統,跟隨時代潮流,掌握新一代的布局方案。
1 回答template的簡寫和grid的簡寫有點混亂?
2 回答為什么我這個這個areas被屏蔽了啊
2 回答grid-row 簡寫 斜杠 變成運算了
1 回答在小程序中,justify-content沒有效果
2 回答這里面 這些header main empty sidebar footer 都是哪里來的?我盲猜是你定義的網格線的命名。但是你不寫出來我惶恐
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2019-04-07
寫成一行程序沒問題,程序正常執行
? ? grid-template-areas "title title header header" "time time swiper swiper" "block1 block2 swiper swiper" "block3 block4 swiper swiper" "block5 block6 swiper swiper" "block7 block7 video info"
但是格式很難看,失去了所見既布局的意思,多行的話,代碼沒有執行? ?
?grid-template-areas "title title header header"
? ? ? ? ? ? ? ? ? ? ? ? ???????????"time time swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block1 block2 swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block3 block4 swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block5 block6 swiper swiper"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"block7 block7 video info"
2019-04-07