CS193H: High Performance Web Sites Lecture 24: Vol 2 – CSS Descendant Selectors, Forced Compression Steve Souders Google

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

Wordpress Training with Sarah Sibert. How To... Removing elements from your theme – search bar/dates on posts/comments Change the styling of headings.
CS193H: High Performance Web Sites Lecture 9: Rule 5 – Put Stylesheets at the Top Steve Souders Google
CS193H: High Performance Web Sites Lecture 7: Add an Expires Header Steve Souders Google
Steve Souders Even Faster Web Sites Disclaimer: This content does not necessarily.
Steve Souders Even Faster Web Sites Disclaimer: This content does not necessarily.
CS193H: High Performance Web Sites Lecture 22: Vol 2 – Optimize Images, Use Iframes Sparingly, Flush the Document Early Steve Souders Google
CS193H: High Performance Web Sites Lecture 17: Rule 14 – Make Ajax Cacheable Steve Souders Google
CS193H: High Performance Web Sites Lecture 8: Rule 4 – Gzip Components
CS193H: High Performance Web Sites Lecture 3: HTTP and the Web 100 Performance Profile Steve Souders Google
CS193H: High Performance Web Sites Lecture 19: Vol 2 – Load Scripts Without Blocking Steve Souders Google
CS193H: High Performance Web Sites Lecture 10: Rule 6 – Put Scripts at the Bottom Steve Souders Google
CS193H: High Performance Web Sites Lecture 18: Vol 2 – Split the Initial Payload Steve Souders Google
CSS3 OVERVIEW Owen Williams Owen at dynabooks daht com.
© 2007 Triune Group Insight. Strategy. Performance. Cascading Style Sheets (CSS) An Introduction Chris Poteet.
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Copyright © 2003 Pearson Education, Inc. Slide 4-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania.
Cascading Style Sheets
1 © Netskills Quality Internet Training, University of Newcastle Introducing Cascading Style Sheets © Netskills, Quality Internet.
1 A Tool-box for Web-site Maintenance Manjula Patel UKOLN University of Bath Bath, BA2 7AY UKOLN is funded by the Library and Information Commission, the.
September Public Library Web Managers Workshop 2000 Cascading Style Sheets Manjula Patel UKOLN University of Bath Bath, BA2 7AY UKOLN is funded.
Social Web Design 1 Darby Chang Social Web Design.
The University of Adelaide HTML Basics: Getting your code to work Peter Murdoch March 2014 PREPARING GOOD LOOKING DOCUMENTS.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
Working with Web Tables
Intro to HTML. HTML HTML = HyperText Markup Language Used to define the content of a webpage HTML is made up of tags and attributes Content.
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
Dr. Alexandra I. Cristea CSS Dr. Alexandra I. Cristea Source:
Intro To Cascading Style Sheets By Mario Yannakakis.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
CSS Styling CSS Box Model & CS110: Computer Science and the Internet.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
Cascading Style Sheets
/k/k 1212 Cascading Style Sheets Part one Marko Boon
1 Cascading Style Sheets™ (CSS) Outline 5.1 Introduction 5.2 Inline Styles 5.3 Embedded Style Sheets 5.4 Conflicting Styles 5.5 Linking External Style.
CSS Digital Media: Communication and design 2007.
Advanced Techniques for Web Developers The Power of CSS Sandra Clark Senior Software Developer The Constella Group
Very quick intro HTML and CSS. Sample html A Web Title.
Cascading Style Sheets Basics. Why use Cascading Style Sheets? Allows you to set up a series of rules for all pages in a site. The series may be changed.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
Today’s objectives  Element relations – tree structure  Pseudo classes  Pseudo elements.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
© 2010, Robert K. Moniot Chapter 5 CSS : Cascading Style Sheets 1.
Cascading style sheets CSS
Tutorial 4 Creating Special Effects with CSS
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Cascading Style Sheets Primary readings Presentations Explain & review projects with class mates.
INTERNET APPLICATIONS CPIT405 CSS Cascading Style Sheet Instructor: Omnia H. Alwazzan
More CSS.
CSS Rule Selector Declaration Block Value Attribute Name body {
Cascading Style Sheets
Cascading Style Sheets 2
More CSS.
Cascading Style Sheets Color and Font Properties
Cascading Style Sheets
Tutorial 4 Creating Special Effects with CSS
The Internet 10/20/11 CSS Layout
Presentation transcript:

CS193H: High Performance Web Sites Lecture 24: Vol 2 – CSS Descendant Selectors, Forced Compression Steve Souders Google

announcements Final exam locations: Dec 9, 12:15-3:15 – Gates B03 Dec 12, 12:15-3:15 – Gates B01

CSS selectors ID selector #chapter1 { text-align: center } element whose ID attribute has the value "chapter1" class selector.pastoral { color: green } elements with class=pastoral type selector H1 { font-family: sans-serif } all H1 elements in the document tree

(bad) CSS selectors descendant selector H1 EM { color: blue } all EM elements anywhere within an H1 child selector BODY > P { line-height: 1.3 } all P elements whose parent is BODY adjacent sibling selector H1 + DIV { margin-top: -5mm } a DIV that immediately follows an H1 universal selector * {} /* all elements */ [hidden="true"] {} all elements where the "hidden" attribute is "true"

Writing Efficient CSS "The style system matches a rule by starting with the rightmost selector and moving to the left through the rule's selectors. As long as your little subtree continues to check out, the style system will continue moving to the left until it either matches the rule or bails out because of a mismatch." H1 EM { color: blue } find every EM, traverse its ancestors until you find an H1 BODY > P { line-height: 1.3 } find every P, check if its parent is BODY H1 + DIV { margin-top: -5mm } find every DIV, check if its previous sibling is an H1 all rules are checked on every redraw (?)

Writing Efficient CSS 1.avoid universal selectors 2.don't qualify ID selectors bad: DIV #navbar {} good: #navbar {} 3.don't qualify class selectors bad: LI.tight {} good:.li-tight {} 4.make rules as specific as possible bad: #navbar A {} good:.a-navbar {}

Writing Efficient CSS 5.avoid descendant selectors bad: UL LI A {} better: UL > LI > A {} 6.avoid tag-child selectors bad: UL > LI > A {} best:.li-anchor {} 7.be wary of child selectors 8.rely on inheritance by David Hyatt 4/21/2000

Testing CSS Performance 20K TD elements

Testing CSS Performance 20K DIV > P > A elements no style: control tag: A {} class:.a00001 {}.a20000 {} descender: DIV DIV DIV P A.a00001 {} child: DIV > DIV > DIV > P > A.a00001 {}

CSS3 selectors (bad) more David Hyatt: "The sad truth about CSS3 selectors is that they really shouldn’t be used at all if you care about page performance. Decorating your markup with classes and ids and matching purely on those while avoiding all uses of sibling, descendant and child selectors will actually make a page perform significantly better in all browsers." tors#comment_3942

CSS performance links "Writing Efficient CSS" by David Hyatt: Hyatt's comment on Shaun Inman's "CSS Qualified Selectors" blog: "Testing CSS Performance" by Jon Sykes: summarizes Sykes:

Where's Accept-Encoding? 5-25% of requests are missing Accept-Encoding most of these are from browsers that support compression Why is Accept-Encoding missing? proxies 11% of overall requests contain VIA header 38% of requests missing A-E contain VIA anti-virus software on client ACCEPT-ENCODING=gzip, deflate ACCEPT_ENCODXNG=gzip, deflate _______________=

total text (K_compressed) total text (K_uncompressed) binary (K) aol.com ebay.com facebook.com google.com/search search.live.com/results msn.com myspace.com en.wikipedia.org/wiki yahoo.com youtube.com average Compressable content December 2008

Missed opportunity n = % requests missing A-E but support compression average page weight with missing A-E: w 1 = (149*(1-n) + 401*n) average page weight if they had A-E: w 2 = potential savings: s = (w 1 - w 2 )/ w 1 ns 5% 10% 15%14% 20%18%

Solving the problem force compression if User-Agent is known to support compression, then return compressed content regardless of A-E work with vendors encourage proxy and anti-virus vendors to support compressed content

Questions List seven types of CSS selectors. What's the key thing to remember about how selectors are applied? What are some techniques for making selector matching faster?