Наши последние новости, обновления и истории для разработчиков

Display images without causing layout shifts

    27 февраля 2025 г.

    Creating placeholders for page content can sometimes be as simple as adding a background effect to existing page elements. In this example, all list items share the same underlying HTML structure. However, the placeholders are styled with a gray

    • CSS
    • HTML
    • JavaScript

    27 февраля 2025 г.

    Reserve space for future page content

      27 февраля 2025 г.

      It is incredibly important to deliver fonts quickly: faster font delivery not only means that text will be visible to the user sooner - but it also has a large impact on whether a font causes layout shifts. If a font cannot be delivered before it is

      • HTML

      27 февраля 2025 г.

      Avoid layout shifts when using infinite scroll

        27 февраля 2025 г.

        Banners and notices that don't cause layout shifts

          27 февраля 2025 г.

          This carousel uses CSS scroll snap to create smooth, performant slide transitions that do not cause layout shifts. This carousel can be navigated in a variety of ways: in addition to navigation controls, it supports keyboard navigation and swiping.

          • HTML
          • JavaScript
          • CSS

          27 февраля 2025 г.

          Animated GIFs can be 5-20x larger than the equivalent MP4 video. However, MP4 videos can be configured to look and feel like GIFs by including the autoplay loop muted playsinline attributes on the <video> tag. In addition, to prevent layout

          • HTML

          27 февраля 2025 г.

          This animated footer slides-in from the bottom of the page. The effect is created by using the CSS transform property. The result is a performant animation that does not cause layout shifts.

          • CSS
          • JavaScript
          • HTML

          27 февраля 2025 г.

          Performant carousels

            27 февраля 2025 г.

            Responsive images are often implemented with the srcset attribute. The srcset attribute is a comma-separated list of image filenames and their width or density descriptors. To prevent layout shifts, set the width and height attributes on <img>

            • HTML

            27 февраля 2025 г.

            This infinite scroll implementation is designed to ensure that there are never any layout shifts - regardless of how long it takes the server to respond with new content. One of the most common issues with many infinite scroll implementations is

            • CSS
            • HTML
            • JavaScript

            27 февраля 2025 г.

            When optimizing video for Core Web Vitals make sure to set the width and height attributes on the <video> tag. Depending on the situation, you may also want to utilize the poster attribute. width and height attributes: To prevent layout shifts,

            • CSS
            • HTML

            27 февраля 2025 г.

            Performant Video

              27 февраля 2025 г.

              Sticky footers are a popular way of displaying notices. Notices placed in the footer are less likely to obscure page elements like navigation bars, branding, and banner ads. In addition, sticky footers do not cause layout shifts when they are

              • CSS
              • JavaScript
              • HTML

              27 февраля 2025 г.

              Modals can be used as an alternative to banner notices. Because modals get displayed on top of existing page content, they do not cause layout shifts when they are displayed. This modal grows in size to fit its contents.

              • JavaScript
              • HTML
              • CSS

              27 февраля 2025 г.

              Load fonts quickly

                27 февраля 2025 г.

                Self-hosted fonts are font files that are served from your own servers - rather than those of a third-party font provider (for example, Google Fonts). It is incredibly important to deliver fonts quickly: faster font delivery not only means that text

                • HTML

                27 февраля 2025 г.

                Setting the width and height attributes on <img> tags helps prevent layout shifts. This information allows the browser to reserve the correct amount of space for the image. Set the width and height attributes: The values of these attributes

                • HTML

                27 февраля 2025 г.