Search Results

  1. CSS and Network Performance

    JavaScript and images tend to get the bulk of the blame for slow websites, but Harry explains very clearly why CSS is equally to blame and harder to deal with:

    1. A browser can’t render a page until it has built the Render Tree;
    2. the Render Tree is the combined result of the DOM and the CSSOM;
    3. the DOM is HTML plus any blocking JavaScript that needs to act upon it;
    4. the CSSOM is all CSS rules applied against the DOM;
  2. Why Browsers Download Stylesheets with Non-Matching Media Queries

    Say you have a stylesheet linked up like this:

    <link href="mobile.css" rel="stylesheet" media="screen and (max-width: 600px)">

    But as the page loads, you're on a desktop browser where the screen is 1753px wide. The browser should just skip loading that stylesheet entirely, right? It doesn't. Thomas Steiner explains:

    it turns out that the CSS spec writers and browser implementors are actually pretty darn smart about this:

    The thing is, the user could always decide to resize their window (impacting width, height, …

  3. How we made Carousell’s mobile web experience 3x faster

    Both a sobering and interesting read from Stacey Tay on how the team at Carousell gathered the metrics to define a performance budget and, in turn, developed a better experience for their customers:

    Our new PWA listing page loads 3x faster than our old listing page. After releasing this new page, we’ve had a 63% increase in organic traffic from Indonesia, compared to our our all time-high week. Over a 3 week period, we also saw a 3x increase in …

  4. Subset Numerals so They’re as Awesome as the Rest of Your Content

    You’re putting the finishing touches on your new million-dollar-idea — your copy is perfect, your color scheme is dazzling, and you’ve found a glorious font pairing (who knew Baskerville and Raleway looked so great together? You did.) but there’s one problem: Raleway’s pesky lowercase numbers make your shopping cart look confusing and overwhelm the user.

    This is a fairly mundane problem, but an issue that can make beautiful typefaces unusable if numbers are an important part of your site; a …

  5. The Three Types of Performance Testing

    We've been covering performance quite a bit — not just recently, but throughout the course of the year. Now, Harry Roberts weighs in by identifying three types of ways performance can be tested.

    Of particular note is the first type of testing:

    The first kind of testing a team should carry out is Proactive testing: this is very intentional and deliberate, and is an active attempt to identify performance issues.

    This takes the form of developers assessing the performance …

  6. Hard Costs of Third-Party Scripts

    Dave Rupert:

    Every client I have averages ~30 third-party scripts but discussions about reducing them with stakeholders end in “What if we load them all async?” This is a good rebuttal because there are right and wrong ways to load third-party scripts, but there is still a cost, a cost that’s passed on to the user. And that’s what I want to investigate.

    Yes, performance is a major concern. But it's not just the loading time and final weight …

  7. Building Skeleton Components with React

    One of the advantages of building a Single Page Application (SPA) is the way navigating between pages is extremely fast. Unfortunately, the data of our components is sometimes only available after we have navigated to a specific part of our application. We can level up the user’s perceived performance by breaking the component into two pieces: the container (which displays a skeleton view when it’s empty) and the content. If we delay the rendering of the content component until we …

  8. Lazy Loading Images with Vue.js Directives and Intersection Observer

    When I think about web performance, the first thing that comes to my mind is how images are generally the last elements that appear on a page. Today, images can be a major issue when it comes to performance, which is unfortunate since the speed a website loads has a direct impact on users successfully doing what they came to the page to do (think conversation rates).

    Very recently, Rahul Nanwani wrote up an extensive guide on lazy loading images

  9. A Minimal JavaScript Setup

    Some people prefer to write JavaScript with React. For others, it’s Vue or jQuery. For others still, it is their own set of tools or a completely blank document. Some setups are minimal, some allow you to get things done quickly, and some are crazy powerful, allowing you to build complex and maintainable applications. Every setup has advantages and disadvantages, but positives usually outweigh negatives when it comes to popular frameworks verified and vetted by an active community.

    React and …

  10. The “Developer Experience” Bait-and-Switch

    Alex Russell describes his thoughts on the current state of JavaScript and how we might sometimes put a ton of focus on the ease-of-use of development at the expense of user experience. So, for example, we might pick a massive framework to make development easier and faster but then that might have an enormous impact on the user.

    Alex describes it as substituting “developer value for user value.”

    The “developer experience” bait-and-switch works by appealing to the listener’s parochial interests …

  11. Putting things on top of other things

    A plain-language romp through the trials and tribulations of z-indexby Isabel Brison. On the surface, z-index seems simple. It's a number and it represents what is on top of what... assuming it is positioned... and assuming it is within the same stacking context as the other things.

    ... that is the gist of it: stacking contexts are caused by a variety of properties and the main reasons for their existence are performance concerns and ease of implementation by browsers. …

  12. The Complete Guide to Lazy Loading Images

    Images are critical. Whether it is marketing banners, product images or logos, it is impossible to imagine a website without images. Sadly though, images are often heavy files making them the single biggest contributor to the page bloat. According the HTTP Archive’s State of Images report, the median page size on desktops is 1511 KB and images account for nearly 45% (650 KB) of that total.

    That said, it’s not like we can simply do away with images. They’re …

  13. Aspect Ratio Media Elements and intrinsicsize

    If you need an aspect-ratio sized <div></div> (or any element that can have children), you can do it. Perhaps the cleanest way is a custom-property-sized pseudo-element that pushes the correct minimum height through padding-based-on-width.

    But media elements like <img /> don't have children. The <video></video> tag isn't self-closing, but when it is supported (almost always), the content of it is replaced with a shadow DOM you don't control. Besides, these are the only two elements that "size to an …

  14. The Low Hanging Fruit of Web Performance

    I kicked off a really poppin' Twitter thread the other day:

    What are the LOWEST hanging fruit of web performance? Nothing fancy, anyone can do, big impact.

    Gzip. Optimize stuff. Reduce requests...

    What are other big ones?

    — Chris Coyier (@chriscoyier) August 17, 2018

    So, I decided to round up all the ideas (both my own and yours) around that in a post over on the Media Temple blog.…

  15. Jetpack’s Social Integration Features

    One of the many things we use Jetpack for here on CSS-Tricks is all of its features related to social media integration. For example, Jetpack can automatically share published content to different social media accounts simultaneously, add sharing buttons to your site's theme, and allow for social login on the comment form. There is even more than that, but let's dig into these three as we use them.…

  16. Flutter: Google’s take on cross platform

    Flutter is a mobile SDK that, at its core, is about empowering everyone to build beautiful mobile apps. Whether you come from the world of web development or native mobile development, Flutter makes it easier to create mobile apps in a familiar, simplified way, without ever giving up control to the framework.…

  17. Render Caching for React

    Server Side Rendering (SSR) is a very useful technique that makes web apps appear faster. The initial HTML is displayed before the JavaScript is parsed and, while the user is deciding what to tap on, our handlers are ready.

    Server side rendering in React requires additional work to setup and has server costs. Furthermore, if your server team cannot have JavaScript running on your servers, you are stuck. It significantly complicates the CDN setup especially if you have pages that …

  18. Props and PropTypes in React

    React encourages developers to build by breaking a UI up into components. This means there will always be a need to pass data from one component to another — more specifically, from parent to child component — since we’re stitching them together and they rely on one another.

    React calls the data passed between components props and we’re going to look into those in great detail. And, since we’re talking about props, any post on the topic would be …

  19. Super-Powered Grid Components with CSS Custom Properties

    A little while ago, I wrote a well-received article about combining CSS variables with CSS grid to help build more maintainable layouts. But CSS grid isn’t just for pages! That is a common myth. Although it is certainly very useful for page layout, I find myself just as frequently reaching for grid when it comes to components. In this article I’ll address using CSS grid at the component level.…

  20. A Native Lazy Load for the Web

    A new Chrome feature dubbed "Blink LazyLoad" is designed to dramatically improve performance by deferring the load of below-the-fold images and third-party <iframe></iframe>s.

    The goals of this bold experiment are to improve the overall render speed of content that appears within a user’s viewport (also known as above-the-fold), as well as, reduce network data and memory usage. ✨…

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag :)