Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit I Applying Advanced Styling CSS. CSS3 can style many aspects that in the past required integration of images New features are not supported by all.

Similar presentations


Presentation on theme: "Unit I Applying Advanced Styling CSS. CSS3 can style many aspects that in the past required integration of images New features are not supported by all."— Presentation transcript:

1 Unit I Applying Advanced Styling CSS

2 CSS3 can style many aspects that in the past required integration of images New features are not supported by all browsers. Should try to make Web site usable for users with the least-featured browser.

3

4 Two sides to a coin Progressive enhancement Graceful degradation It is a matter of direction.

5 Graceful degradation: ensuring that when site is viewed in browsers that don’t support advanced features, Web page elements should still be displayed in a usable way.

6 Graceful degradation: ”The practice of building your web functionality so that it provides a certain level of user experience in more modern browsers, but it will also degrade gracefully to a lower level of user experience in older browsers. This lower level is not as nice to use for your site visitors, but it does still provide them with the basic functionality that they came to your site to use; things do not break for them.” ww3.org

7 Graceful degradation o Appearance and usability of Web site don’t depend on advanced features o Example: specifying alternative text for an image, in case the image cannot be displayed

8 Progressive enhancement: additional features are used as enhancements only for browsers that can render them o Main content and capabilities available for least-featured browser o Advanced features not crucial to the layout of the Web site

9 Progressive enhancement enables us to establish a solid baseline of cross-browser support and then enhance the design with advanced CSS features for supportive browsers.

10 Graceful degradation starts from the status quo of complexity and tries to fix for the lesser experience whereas progressive enhancement starts from a very basic, working example and allows for constant extension for future environments. Degrading gracefully means looking back whereas enhancing progressively means looking forward whilst keeping your feet on firm ground.

11 Shims or patches: Scripts written specifically to bridge the gap between browsers with reduced feature sets and more fully featured browsers o Available for use by anyone free of charge o Some address a single issue o Some tools package shims in a library of scripts Examples: Modernizr, PIE

12 Pseudo-element: selectors that enable you to isolate a portion of a larger element for styling o Preceded by colon (:) in older browsers or by double colon (::) in newer ones Double colon distinguishes pseudo- element from pseudo-class A pseudo-class filters existing elements. a:link means all s that are :link. A pseudo-element is a new fake element. div::after means non-existing elements after s.

13 Drop cap: First letter is enlarged and drops below the first line of text Can be created using :first-letter Must format surrounding text to flow around – use the float property

14 :first-line pseudo-element applied to paragraph

15 :before and :after pseudo-elements: allow you to insert content into Web page using style rules o Typically used for repeated text or pictures o Must specify value for the content property Can be text or path to an image http://krasimirtsonev.com/blog/article/CSS- before-and-after-pseudo-elements-in-practice

16 :before pseudo-element code and result

17 What is the difference between opacity and transparency? Opacity is just the opposite of transparency. If something is 100% opaque, then it's 0% transparent. If it's 75% transparent, then it's 25% opaque.

18 Opacity Color can be specified in hexadecimal, rgb, and hsl – hue saturation light. Alpha channel: fourth color value representing the opacity o Works for rgb and hsl, known as rgba and hsla o Receives decimal between 0 (fully opaque) and 1 (fully transparent). http://deepubalan.com/blog/2010/03/29/rgba-vs-opacity-the- difference-explained /

19 Opacity – Graceful degradation o Many browsers do not support the rgba property. o Using the concept of graceful degradation - use this along with rgb

20 rgba code and resulting partially transparent element RGB RGBA

21 Creating rounded corners is possible using the CSS3 border-radius property

22 In past, required overlay of image files simulating the rounded edge

23 border-radius property Receives value in pixels Larger value results in deeper curves Can use individual property for each corner Requires –moz and –webkit prefixes to work with some browsers

24 Code for rounded footer corners and resulting element

25

26 border-radius: 1em; border-radius-topright: 2em; border-radius-topleft: 2em; border-radius: 2em 0; border-radius: 3em 1em; border-radius: 1em; border-radius-topright: 2em; border-radius-topleft: 2em; border-radius: 2em 0; border-radius: 3em 1em;

27 Text shadow: creates the appearance of a shadow on a surface behind the text o In past, required using image manipulation software and linking to resulting graphic In CSS3, use text-shadow property o Takes four values: horizontal offset, vertical offset, blur, and shadow color

28 Values for the text shadow property and resulting graphic text-shadow: 2px 3px 2px #000; http://designshack.net/articles/css/12-fun-css-text-shadows-you-can- copy-and-paste/

29 Box shadow: creates the appearance of a shadow on an entire unit of page content. o Takes four values: horizontal offset, vertical offset, blur, and shadow color o Has –webkit and –moz variants http://www.w3schools.com/css/css3_shadows.asp http://www.w3schools.com/css/css3_shadows.asp Examples of both text and box shadow

30 Examples

31 Code for box-shadow

32 Modernizr: free script library for enabling alternative code in order to support graceful degradation o Linked to a Web page and tests each user’s browser to detect supported properties o Based on results, generates set of CSS classes, which can be used by designer to write alternative code and make sure that only the suitable code is rendered

33 Code incorporating Modernizr script

34 So HTML5 and CSS3 are not that confusing when you have good teachers.

35 But wait there’s 2 more.


Download ppt "Unit I Applying Advanced Styling CSS. CSS3 can style many aspects that in the past required integration of images New features are not supported by all."

Similar presentations


Ads by Google