H T M L / C S S 獮 ᒒ च 器 拻 ଷ - 3
W W C O D E TA I P E I F E S T U D Y G R O U P
Friday, September 30, 2016
Syntrend 11F
Win.Wu (yiyingwu.1990{{at}}gmail.com)
Slide 2
Slide 2 text
虻 碘 ӥ 斉
9/9, 9/23, 9/30, 10/7 ᮷ᥝ᯿碝ӥ斉
http://goo.gl/wC5a6l
蝱獈盅牧讨螡ݦӤ薫 Clone or download
簁盅螡䢔 Download ZIP
Slide 3
Slide 3 text
C O N T E N T M O D E L
Content Model ݈圸傶կ獉秇ࣳ牐
蝢ଉդ蔭礓㮆 HTML زᔰ愊ᶎݢ犥硯犚獉牐
穉斃ଉአ/墋㻌অቘ薹ጱ牧磪 block/inline/inline-block
Slide 4
Slide 4 text
य़蟂獤ጱ HTML زᔰ”毆戔”
䨝ᤩ稳觊傶 block ฎ inline
block
㰍ฎڜ膐
Slide 5
Slide 5 text
य़蟂獤ጱ HTML زᔰ”毆戔”
䨝ᤩ稳觊傶 block ฎ inline
inline
㰍ฎڜ膐
B L O C K 膏 I N L I N E ጱ 橕 狌
block
inline
block 愊ݢ犥硯 block, inline
inline 愊犋ݢ犥硯 block
Slide 10
Slide 10 text
C S S ই ֜ 矒 ګ M O D E L
ݢ犥ڥአ CSS ጱ display 痀牧
硬虋扗 HTML زᔰጱ Content Model
display: block|inline|inline-block|table|flex
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Slide 11
Slide 11 text
• Float
• Position
膏 Layout 磪橕
Slide 12
Slide 12 text
F L O AT
float ݈圸傶ၶ㵕牧ፓጱࣁෝ虏 HTML زᔰ᪡脒毆戔
ጱ矎ڜොୗ牧觊犲ࣁ翥蜉 word 碻ጱ媅瑽ොୗ牐ଉଉአ㬵
粚ᶎ蟴ᗝ牐
薹ᴻ float ᥝአ clear 痀牐Ջ讕碻狡襑ᥝአک薹ᴻ?!
磪አک float ጱ碻狡牐
獡ԪےӤ float 痀ጱزᔰ牧ቘ抷Ӥ犖᮷ᥝ磪 width 痀 牐
Slide 13
Slide 13 text
C L E A R
Ӟ෮౯㮉ࣁ殷ᶎӤ磪ֵአک float 矎粚碻牧ԏ盅ጱزᔰ疰䨝
虋౮狅ᆙ瞲ਧጱ float ොݻ (left, right) 媣媲ၶ㵕牐ಅ犥殾
ᥝ磪Ӟ㮆Ӿ䥁讨ฎአ㬵薹ᴻ float 硳ຎጱ牧ᘒ薹ᴻ float 疰
襑ᥝֵአ clear 痀牐
戔ਧ clear زᔰ牧䨝०݄ margin-top牐
TIP: 橕ෝ clear ֦ӞਧᥝᎣ螇 clearfix
http://stackoverflow.com/questions/211383/what-methods-of-clearfix-can-i-use
Slide 14
Slide 14 text
P O S I T I O N
s t a t i c re l a t i v e absolute f i x e d
CSS ጱ position 痀牧మ蕣֢斃蕦褾ጱ戔懯牧犋మ
ݑ褖ෝ HTML ܻጱ矎ڜ殼ଧ牧疰襑ᥝֵአ position牐
砇蟴 top, right, both, left ࢥ圵独㬵究ਧਧ֖牐
Slide 15
Slide 15 text
P O S I T I O N
s t a t i c
static ฎ毆戔独牧ݝᥝ䷱磪粬獨朼䌘 HTML زᔰ戔ਧ position牧
毆戔ጱ position 疰䨝ฎ static牐
Slide 16
Slide 16 text
P O S I T I O N
re l a t i v e
relative चӤ蚤 static 盄猟牧吚֦ࣁӞ㮆زᔰӤےӤ
position: relative 眤ݑ犋ڊก氥ጱ癩吖牧֕犢ݢ犥ֵአ top, left,
right, bottom 缛痀牧㪔Ӭ䌘ෝৼزᔰ㬵藯ٍ磪ᆿ䍅ਧ֖ጱ硳ຎ牐
Slide 17
Slide 17 text
P O S I T I O N
absolute
absolute ጱਧ֖犥ᆿزᔰ傶च器牐
(藨聲ᇁ究ਧਙࣁߺ愊)
Slide 18
Slide 18 text
P O S I T I O N
f i x e d
ࡅ稭ڬਂࣁ眤ጱ痀牧fixed ጱਧ֖犥憙绯傶च器牐ࢴਧ犋㵕牐
Slide 19
Slide 19 text
Z - I N D E X
砇蟴 position: relative | absolute | fixed ֵአ
ݢ究ਧ薟荠氥纈ጱض盅殼ଧ牧ℂ 0 , 1, 2… 碍ਁ᩼य़᩼ṛ牐
z-index: 2
z-index: 1
z-index: 0
Slide 20
Slide 20 text
B O X S I Z I N G
• box-sizing ฎ CSS 憒ਧ Box Model ጱ薹ຉොୗ
• content-box 毆戔ጱොୗ牧懯ᓒ width/height 碻犋۱珀
padding/border
• border-box牧懯ᓒ width/height ฎ padding/border 懯ᓒ
ࣁ獉牐
Slide 21
Slide 21 text
Ӟ 犚 穉 斃 磪 蚕 ጱ 愆 獅
Slide 22
Slide 22 text
愆 獅
• reset
• css property prefix for vendors
• facebook meta og https://developers.facebook.com/
docs/sharing/best-practices
• Media Query
• ૢݦᗝӾ
C S S G E N E R AT O R … 膐 ֺ 皃 㮆
http://www.colorzilla.com/gradient-editor/
http://apps.eky.hk/css-triangle-generator/
http://bennettfeely.com/clippy/
橕棎ਁ: css _____ generator