- This topic has 10 replies, 5 voices, and was last updated 3 years, 3 months ago by
Ivaylo.
-
AuthorPosts
-
January 29, 2023 at 1:18 am #2512698
Ivaylo
Hi,
I’m trying to find out what is causing the CLS on my website. I’m trying different tools and everytime I see the different things.1. Sometimes it is the logo ( while it is already with a reserved space via CSS )
2. Sometimes it is the Breadcrumbs or the font they are using.
etc.Could you please check with your tools and let me know how to fix it?
It is currently around 0.08 and while it is below 0.1 it gets sometimes a way over it.
Thanks!
January 29, 2023 at 5:35 am #2512854David
StaffCustomer SupportHi there,
One potential issue is the Fonts display property is set to
swapyou may want to consider NOT doing that, as it can be a leading cause of CLS. As your font that gets loaded later may vary a lot from the users system font, resulting in CLS.For the logo, don’t lazyload it. It has a CSS class of
is-logo-imagethat you can use in your lazy loaders exclusions. This will reduce the chances of it getting resized on load.January 29, 2023 at 5:42 am #2512858Ivaylo
Thanks, David!
1. If I got this right about fonts, my best option is to select a system font for both Breadcrumbs and Author/Update on? am I right? Choosing a system font for both will be the best option, won’t cause any delay and shift?
2. About the logo, I saw it is lazyloaded, but was assured that when there is a space reserved for it, it doesn’t matter. I have the following code in my Additional CSS.
/* FIXed CLS issues on mobile*/ @media only screen and (max-width: 600px) { .site-header { position: relative; min-height: 87px; } }I have uploaded a png file with 200x87px dimensions.
Thanks!
January 29, 2023 at 6:25 am #2512892David
StaffCustomer Support1. Correct = that would be the best option.
2. As long as the
<img>haswidthandheightattributes ( and your logo does ) then the browser will reserve the correct space for it.
If theres any shifting then some other code is affecting it.
As the image is above the fold, you don’t to lazy load it, and its one less thing that could cause an issue.January 29, 2023 at 6:48 am #2512912Ivaylo
1. How can I set a system font to Breadcrumbs ( Generated by RankMath/GPBlocks ) and Author/Updated created by this code:
add_filter( ‘generate_post_date_output’,’tu_add_to_post_date’ ); function tu_add_to_post_date( $output ) { return ‘<span class=”date-label”>Updated on </span>’ . $output; } add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );2. Thanks, I’ve added an exclusion to the logo, could you please verify on your end if it is still lazy loaded for the below example.
January 29, 2023 at 6:35 pm #2513541Fernando Customer Support
Hi Ivaylo,
1. You can create a new Typography Rule in Appearance > Customize > Typography > Typography Manager. Set the Target Element to Custom –
.content-area nav.rank-math-breadcrumb, .content-area .inside-article .entry-header .entry-metaAfter doing so, set the font family to
System Default.2. It seems the logo and CLS are good now with the CSS you’ve added. Upon my latest test, this is the result in terms of CLS: https://share.getcloudapp.com/6quNAzg5
January 30, 2023 at 11:03 am #2514524Geoffrey A.
Hi David,
I have the same CLS problem. I looked at your links and installed simple CSS, but I do not understand what do I have to add there. Could you please tell me what to do?
January 30, 2023 at 12:21 pm #2514606Ying
StaffCustomer SupportHi Geoffrey,
Can you open your own topic and link us to where David asked you to install simple CSS so we can know what was the conversation before?
March 1, 2023 at 12:20 pm #2551877Ivaylo
Successfully changed the breadcrumbs font to the system default, Thanks!
March 2, 2023 at 1:45 am #2552325David
StaffCustomer SupportGlad to hear that
March 2, 2023 at 2:15 am #2552358Ivaylo
Resolved
-
AuthorPosts
- You must be logged in to reply to this topic.