{"id":310151,"date":"2021-10-26T14:38:03","date_gmt":"2021-10-26T14:38:03","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=310151"},"modified":"2022-07-07T08:49:31","modified_gmt":"2022-07-07T08:49:31","slug":"improve-cls-and-lcp","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/","title":{"rendered":"Tips to Improve CLS and LCP : Core Web Vitals"},"content":{"rendered":"\n<p>Nowadays, customer experience means more than just speed index of a website. Google announced Core Web Vitals metrics in early May 2020. According to Google, <em>Core Web Vitals are a set of real-world, user-centered metrics that quantify key aspects of the user experience.<\/em> The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep in mind while developing a theme to maintain CLS and LCP score.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The CLS and LCP : An Overview<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">CLS : Cumulative Layout Shift<\/h3>\n\n\n\n<p>Cumulative Layout Shift which is a measure of the largest burst of&nbsp;<em>layout shift scores<\/em>&nbsp;for every&nbsp;<a href=\"https:\/\/web.dev\/cls\/#expected-vs.-unexpected-layout-shifts\">unexpected<\/a>&nbsp;layout shift that occurs during the entire lifespan of a page. Unexpected movement of page content usually happens because DOM elements are adding dynamically to the page above existing content.<\/p>\n\n\n\n<p>The CLS metric helps you address this problem by measuring how often it is occurring for users. A website should strive to have a CLS score of&nbsp;<strong>0.1<\/strong>&nbsp;or less.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">LCP : Largest Contentful Paint<\/h3>\n\n\n\n<p>The Largest Contentful Paint reports the render time of the largest image or text block visible within the viewport. The loading time may increase if there is critical resource blocking the loading time. E.g. any large CSS\/JS\/image file.<\/p>\n\n\n\n<p>To provide a good user experience, website should have LCP of 2.5 seconds or less.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tips to Improve CLS<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Always provide width and height attributes for image elements in DOM. Alternatively, you can allocate space for image using CSS aspect ratio. It will avoid layout shift while image is loading. This also applies to Ads, embeds, and iframes.<\/li><li>Try to avoid moving elements with Javascript without user interaction. If the upper elements are already loaded, then moving elements will result in layout shifts. <\/li><li>Use <em>font-display<\/em> property in Web Fonts or use Web Font APIs. The custom fonts without font-display property can cause FOUT (flash of un-styled text) or FOIT (flash of invisible text):<ul><li>FOUT occurs when text font is basic system font while custom font is loading.<\/li><li>FOIT occurs when text is invisible while custom font is loading.<\/li><li>Combine <em>font-display: optional;<\/em> and <em>&lt;link rel=&#8221;preload&#8221;&gt;<\/em> to best manage the custom fonts.<\/li><\/ul><\/li><li>Prefer transform animations to animations of properties that trigger layout changes. The transform animation style can change various properties with less cost on CLS.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tips to Improve LCP<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Defer any non-critical JavaScript and CSS to speed up loading of the main content of your web page.<\/li><li>Minify CSS and JS files to reduce blocking time.<\/li><li>Remove any unused CSS or JS.<\/li><li>Optimize and compress images and text files to reduce size and thus, loading time.<\/li><li>Convert images into newer formats such as JPEG 2000, JPEG XR, or WebP for better LCP.<\/li><li>Consider using a CDN for assets (CSS\/JS\/Images etc.) to avoid wait for loading assets from faraway servers.<\/li><li>Follow best cache policy for static assets.<\/li><\/ul>\n\n\n\n<p>That&#8217;s all about improving CLS and LCP scores while development of a theme. If any issue or doubt in the above process, please feel free to let us know in the comment section. <\/p>\n\n\n\n<p>I would be happy to help.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Also, you can explore our <a href=\"https:\/\/webkul.com\/prestashop-development\/\">PrestaShop Development Services<\/a>  and a large range of quality <a href=\"https:\/\/store.webkul.com\/PrestaShop-Extensions.html\">PrestaShop Modules<\/a>.<\/p>\n\n\n\n<p>For any doubt contact us at <a href=\"mailto:support@webkul.com\">support@webkul.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nowadays, customer experience means more than just speed index of a website. Google announced Core Web Vitals metrics in early May 2020. According to Google, Core Web Vitals are a set of real-world, user-centered metrics that quantify key aspects of the user experience. The CLS and LCP play a major role in defining a better <a href=\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":264,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-310151","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tips to Improve CLS and LCP : Core Web Vitals - Webkul Blog<\/title>\n<meta name=\"description\" content=\"The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep better CLS and LCP score.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tips to Improve CLS and LCP : Core Web Vitals - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep better CLS and LCP score.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-26T14:38:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-07T08:49:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ram Chandra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ram Chandra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\"},\"author\":{\"name\":\"Ram Chandra\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71\"},\"headline\":\"Tips to Improve CLS and LCP : Core Web Vitals\",\"datePublished\":\"2021-10-26T14:38:03+00:00\",\"dateModified\":\"2022-07-07T08:49:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\"},\"wordCount\":556,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\",\"url\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\",\"name\":\"Tips to Improve CLS and LCP : Core Web Vitals - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2021-10-26T14:38:03+00:00\",\"dateModified\":\"2022-07-07T08:49:31+00:00\",\"description\":\"The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep better CLS and LCP score.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tips to Improve CLS and LCP : Core Web Vitals\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71\",\"name\":\"Ram Chandra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ram Chandra\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ram-chandra178\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tips to Improve CLS and LCP : Core Web Vitals - Webkul Blog","description":"The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep better CLS and LCP score.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/","og_locale":"en_US","og_type":"article","og_title":"Tips to Improve CLS and LCP : Core Web Vitals - Webkul Blog","og_description":"The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep better CLS and LCP score.","og_url":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2021-10-26T14:38:03+00:00","article_modified_time":"2022-07-07T08:49:31+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Ram Chandra","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ram Chandra","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/"},"author":{"name":"Ram Chandra","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71"},"headline":"Tips to Improve CLS and LCP : Core Web Vitals","datePublished":"2021-10-26T14:38:03+00:00","dateModified":"2022-07-07T08:49:31+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/"},"wordCount":556,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/","url":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/","name":"Tips to Improve CLS and LCP : Core Web Vitals - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2021-10-26T14:38:03+00:00","dateModified":"2022-07-07T08:49:31+00:00","description":"The CLS and LCP play a major role in defining a better score for a website. Here are some important points to keep better CLS and LCP score.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/improve-cls-and-lcp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Tips to Improve CLS and LCP : Core Web Vitals"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71","name":"Ram Chandra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ram Chandra"},"url":"https:\/\/webkul.com\/blog\/author\/ram-chandra178\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/310151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/264"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=310151"}],"version-history":[{"count":4,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/310151\/revisions"}],"predecessor-version":[{"id":310156,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/310151\/revisions\/310156"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=310151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=310151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=310151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}