05-Understanding CSS Essentials Layouts
05-Understanding CSS Essentials Layouts
• Vyacheslav Koldovskyy
Last update: 21/02/2017
Agenda
• UI design
• Traditional CSS Box model
• Block-level and inline element
• Parent/child relationships
• Vendor prefixes
• CSS Flexbox Box model
• CSS Grid Layout model
Vendor Prefixes
By default, all browsers use the W3C box model, with the exception of IE in "Quirks Mode"
(IE5.5 Mode), which uses the traditional one.
box-sizing: border-box
box-sizing: content-box
Box model sample
http://jsfiddle.net/koldovsky/e1984en9/1/
Inherited Properties
• A parent box can contain one or
more child boxes.
• A child can inherit CSS styles from
a parent.
• Sample inherited property:
p { color: green }
<p>This paragraph has <em>emphasized text</em> in it.</p>
• http://jsfiddle.net/koldovsky/jb5h57jw/
CSS3 Grid Layout Model
• Gives developers greater
control over complex layouts
than the flexbox model
• Lets you control the design of
sections or entire HTML-based
documents using CSS3
• Grid layouts use columns, rows, and cells, but
you can move blocks of content from one part
of page or application to another by moving
code lines in CSS
Multi-column Layout
http://jsfiddle.net/koldovsky/2m2Zb/36/
CSS Transition
http://jsfiddle.net/koldovsky/PkJaD/357/
CSS Animation
CSS animations animates transitions between CSS styles to another.
Consist of two components: a style describing the CSS animation and a set of keyframes that
indicate the start and end states of the animation's style, as well as possible waypoints.
There are three key advantages to CSS animations over traditional script-driven animation:
• Easy to use for simple animations.
• The animations run well, even under moderate system load. The rendering engine can use
frame-skipping and other techniques to keep the performance as smooth as possible.
• Letting the browser control the animation sequence lets the browser optimize
performance and efficiency by, for example, reducing the update frequency of animations
running in tabs that aren't currently visible.
Some cool samples:
http://webdesign.tutsplus.com/articles/15-inspiring-examples-of-css-animation-on-codepen--
cms-23937
Details: https://css-tricks.com/almanac/properties/a/animation/
Simple Animation Example
http://jsfiddle.net/koldovsky/e2tt2mao/56/
Timing Functions
https://jsfiddle.net/koldovsky/HDsw2/11/
Details:
https://www.smashingmagazine.com/2014/04/understanding-css-timing-functions/
SVG Filters Support
• Small file sizes that compress well
• Scales to any size without losing clarity (except very tiny)
• Looks great on high-res displays
• An SVG filter is a set of operations that use CSS to style or otherwise modify an SVG graphic
• The enhanced graphic is displayed in a browser while the original graphic is left alone.
Sample: http://codepen.io/chriscoyier/pen/evcBu
36
Styling Tables
http://www.w3schools.com/css/css_table.asp
37
Practice Task
Advanced Topics
CSS Regions
1 2 3
CSS Exclusions
Transition
Animation (Continued)
• feBlend • feMerge
• feColorMatrix • feMorphology
• feComponentTransfer • feOffset
• feComposite • feTile
• feConvolveMatrix • feTurbulence
• feDiffuseLighting • feDistantLight
• feDisplacementMap • fePointLight
• feFlood • feSpecularLighting
• feGaussianBlur • feSpotLight
• feImage
SVG Filters Gaussian Blur Example
SVG Filters Offset Example
Canvas
• context.rotate(20*Math. PI/180);
Canvas Example 3
Contacts
Thank You!
Copyright © 2010 SoftServe, Inc.