Use CSS Reset
Why need CSS reset?
How to use it?
Introduce some CSS reset.
୍ᄅರྒ௹ರ
Slide 4
Slide 4 text
Why need CSS Reset
Different Internet Browser has different
CSS default style
adjust size and style of type to make
uniform appearance
୍ᄅರྒ௹ರ
Slide 5
Slide 5 text
୍ᄅರྒ௹ರ
Slide 6
Slide 6 text
How to use CSS Reset
Put CSS reset at the top of CSS frame
Avoid to use * CSS selector
Don’t just CLEAR but RESET
୍ᄅರྒ௹ರ
Slide 7
Slide 7 text
CSS Reset Resource
First CSS Reset by Tantek
Global White Space Reset: *{ margin:
0;padding: 0;}
YUI CSS Reset
Reset Reloaded by Eric Meyer
KISSY CSS Reset by lifesinger
୍ᄅರྒ௹ರ
Slide 8
Slide 8 text
How to use CSS Reset
Put CSS reset at the top of CSS frame
Avoid to use * CSS selector
Don’t just CLEAR but RESET
Less is more
୍ᄅರྒ௹ರ
Slide 9
Slide 9 text
CSS Box model
୍ᄅರྒ௹ರ
Slide 10
Slide 10 text
Two box models
Quirks & Standards
mode
IE/Mozilla ‘s button
Elements’ bug
IE browser’s doctypes
& the box model
relation
୍ᄅರྒ௹ರ
Slide 11
Slide 11 text
IE Browsers, doctypes and
the box model
Doctype used Win/IE5 Win/IE6
HTML 4.01 Transitional ‐
missing doctype
Quirks Quirks
HTML 4.01 Transitional ‐
full doctype
Standards Standards
XHTML 1.0 Transitional ‐
full doctype
Quirks Quirks
XHTML 1.0 Transitional ‐
missing Prolog
Standards Standards
୍ᄅರྒ௹ರ
Slide 12
Slide 12 text
Block & Inline
୍ᄅರྒ௹ರ
Slide 13
Slide 13 text
CSS Display
3 main display properties: block, inline,
none
Document flow
How to hide an element?
୍ᄅರྒ௹ರ
Slide 14
Slide 14 text
Display:block
Takes up the full width available, with a
new line before and after
,
...
,
,
,
,
,
,
,
,,,
,
୍ᄅರྒ௹ರ
Slide 15
Slide 15 text
Display:inline
Takes up only as much width as it
needs, and does not force new line
,,,,, ,,,
୍ᄅರྒ௹ರ
Slide 16
Slide 16 text
Document flow:Page display order
୍ᄅರྒ௹ರ
Slide 17
Slide 17 text
How to hide an Element?
୍ᄅರྒ௹ರ
Slide 18
Slide 18 text
Hide an element
height:0;overflow:hidden;
visibility:hidden;
display:none;
same color with the background
position it far away from screen range
୍ᄅರྒ௹ರ
Slide 19
Slide 19 text
Two different method
.fn-hide{display:none}
D.addClass(el,’fn-hide’)
el.style.display = ‘none’;
୍ᄅರྒ௹ರ
Slide 20
Slide 20 text
CSS Layout
DIV+CSS VS TABLE
୍ᄅರྒ௹ರ
Slide 21
Slide 21 text
CSS based Layout
Position
Float
Negative margin
display:Table
୍ᄅರྒ௹ರ
Slide 22
Slide 22 text
Position
Static
Relative
Absolute
fixed
In Document Flow
out of Document Flow
୍ᄅರྒ௹ರ
Slide 23
Slide 23 text
Two Position layout Method
relative + absolute;
absolute;
relative
fixed
୍ᄅರྒ௹ರ
Browscap: No CSS Hack
Have a look at
Yahoo.com
source code
.ua-ie6 #head{height:30px;}
.ua-ie7 #head{height:32px;}
.ua-ff3 #head{height:33px;}
୍ᄅರྒ௹ರ
Slide 41
Slide 41 text
IE Haslayout
୍ᄅರྒ௹ರ
Slide 42
Slide 42 text
IE Haslayout
Haslayout is a part of IE CSS Render
Engine
haslayout=-1, such as
body,html,tqble,img,input,iframe,embe
d,hr,marquee(not include div)
Detail...
୍ᄅರྒ௹ರ
How to debug CSS style
Firebug Layout & Style panel
CSS border trick
CTRL+F5 force renew cache
୍ᄅರྒ௹ರ
Slide 46
Slide 46 text
CSS Specification
୍ᄅರྒ௹ರ
Slide 47
Slide 47 text
CSS Specification
Separate words by a single dash, e.g.
span.btn-ok-disabled
Use a meaningful prefix and don’t add
new one, e.g. .fn-, .ft-, .ico-, .btn-, .com-
Use Class selector instead of ID selector
No inline styles in HTML tags
୍ᄅರྒ௹ರ
Slide 48
Slide 48 text
CSS Tricks
୍ᄅರྒ௹ರ
Slide 49
Slide 49 text
Fonts settle multi-language align
problem: SimsunaTahoma
Tag ‘A’ without ‘href’ property cause
‘:hover’ style lapse
‘IE 1px bug’ fixed by ‘overflow:hidden’
Force word not wrap compatible with
IE6,7,FF3đwhite-space:nowrap
CSS files save as no BOM uft-8 format,
୍ᄅರྒ௹ರ
Slide 50
Slide 50 text
CSS comment avoid ‘/******/’
‘caption’ set ‘padding’ instead of
‘margin’ in IE
‘overflow:auto’ element declare
‘position:relative’ to fix its child elements
‘ position bug
No block element in inline element
More...
୍ᄅರྒ௹ರ