dom, html, css ui development basics confidential

Download DOM, HTML, CSS UI Development Basics Confidential

Post on 19-Jan-2016




0 download

Embed Size (px)


PowerPoint Presentation

DOM, HTML, CSSUI Development BasicsConfidentialIntroConfidential2

How it works (render process)How to choose layout architecturePerformance optimizationExpectationConfidential3AgendaConfidential44The rendering process

HTML Source/DOM tree/DOM RenderConfidential5

HTML source The DOM tree Therender treeHTML Source/DOM tree/DOM RenderConfidential6

Parts of the render tree (or the whole tree) will need to be revalidated and the node dimensions recalculated. This is called a reflow, or relayout, or relayouting. Note that there's at least one reflow - the initial layout of the page.

Parts of the screen will need to be updated, either because of changes in geometric properties of a node or because of stylistic change, such as changing the background color. This screen update is called a repaint, or a redraw.Repaints and reflowsConfidential7Task (repaint or reflow ?)Repaints and reflowsConfidential8var bstyle =;

bstyle.padding = "20px";

bstyle.border = "10px solid red";

bstyle.color = "blue";

bstyle.backgroundColor = "#fad";

bstyle.fontSize = "2em";


Var left = el.offsetLeft;

Reflow (offsetTop, offsetLeft, offsetWidth, offsetHeightscrollTop/Left/Width/HeightclientTop/Left/Width/Height

Repaints and reflowsConfidential9// no-no! for(big; loop; here) { = el.offsetLeft + 10 + "px"; = el.offsetTop + 10 + "px"; } // better var left = el.offsetLeft, top = el.offsetTop, esty =;for(big; loop; here) { left += 10; top += 10; esty.left = left + "px"; = top + "px"; } // badvar left = 10,top = 10; = left + "px"; = top + "px";

// betterel.className += " theclassname";

// or when top and left are calculated dynamically...

// += "; left: " + left + "px;top: " + top + "px;"; Layout architectureConfidential10

Why Table Layout is a bad practice?Why Float Layout is a bad practice?Absolute, Percentage, Flex, Inline-Block how to choose The Best.Layout architectureConfidential11Confidential12The EndThank you for your attention!


View more >