[問題] CSS的background-color

看板Web_Design作者 (蟄)時間13年前 (2012/03/13 12:57), 編輯推噓2(204)
留言6則, 4人參與, 最新討論串1/1
小弟想請問一個問題 CSS的background-color是不是要放在每個class或id的最後一行的規定呢? 例: 01: #test1 { 02: position: relative; 03: background-color: #008080 /*Color-selector: Teal*/ 04: height: 500px; 05: margin-top: 26px; 06: } 07: 08: #test2 { 09: position: relative; 10: height: 500px; 11: margin-top: 26px; 12: background-color: #008080 /*Color-selector: Teal*/ 13: } a.因為我的test1一直顯現不出我樣的顏色(#008080),所以我嘗試了test2 b.我的test2可以顯示出我要的顏色 c.test1和test2只有差在 line 03 那行屬於test1的background-color不在末端, 而 line 12 那行屬於test2的background-color位在末端。 d.我會問是因為google過後好像沒有「明確」規定background-color的宣告位置... e.請問大家有甚麼建議嗎? 初學&自學css的我... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.84.63.251

03/13 12:58, , 1F
補充:我用google chrome
03/13 12:58, 1F

03/13 13:10, , 2F
背景那行的分號呢?
03/13 13:10, 2F

03/13 14:39, , 3F
嗯... 是漏掉分號(;)了吧?
03/13 14:39, 3F

03/13 16:11, , 4F
謝謝各位~是我自己少了分號的問題。感謝感謝!
03/13 16:11, 4F

03/13 19:16, , 5F
CSS中,各個屬性間要用分號區隔,最後一個可以省略
03/13 19:16, 5F

03/13 19:16, , 6F
但習慣上最好都把它加上去,讓他統一
03/13 19:16, 6F
文章代碼(AID): #1FNjFCfA (Web_Design)