看板 Web_Design 關於我們 聯絡資訊
各位好,最近在 udemy 初學 CSS,想請求前輩指點一二 這是我練習打的碼 http://jsbin.com/robupe/1/edit?html,output 1. 請問關於階層問題, 為何 background-color: #eee; 要放在 #bar li,不能放在 #bar 或者 #bar ul 內呢? 2. 同樣地, 為何 margin: 0; 要放在 #bar ul 內,不能放在 #bar 或者 #bar li 內呢? 3. 究竟該怎麼看待這樣的階層與屬性的關係?目前找不到邏輯,只知道試三次總會成功 ,但想找個可尋之法。(感覺需要經驗去累積?Orz) 先謝謝各位前輩了! -- 我有想到這張圖片 https://www.pinterest.com/pin/522347256758155078/ 但不知道是不是每個層 (div, ul, li) 都有自己的 padding/border/margin? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.136.11.22 ※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1430922050.A.47D.html ※ 編輯: befdawn (223.136.11.22), 05/06/2015 22:23:56
tw0517tw: 對 box model 05/06 22:52
befdawn: 每個屬性內都有自己的 p./b./m. 原來是這樣,謝謝! 05/06 23:29
Rplus: 初學可以參考 http://zh-tw.learnlayout.com/ 05/08 02:35
Rplus: 打好排版概念基礎對未來實作會有助益 :) 05/08 02:37