{"id":4834,"date":"2021-05-28T18:34:46","date_gmt":"2021-05-28T18:34:46","guid":{"rendered":"https:\/\/www.s-sols.com\/?post_type=doc&#038;p=4834"},"modified":"2025-04-20T20:17:30","modified_gmt":"2025-04-20T20:17:30","slug":"settings-styles-accel","status":"publish","type":"doc","link":"https:\/\/www.s-sols.com\/docs\/wordpress\/accelerator\/settings-accel\/settings-styles-accel","title":{"rendered":"Styles settings Accelerator for WordPress"},"content":{"rendered":"<p>\n  Styles are separated into two categories:\n<\/p>\n<ul>\n<li><strong>Critical<\/strong>\n<p style=\"text-align:left\">\n      It must be loaded before main page content to provide correct page rendering.\n    <\/p>\n<\/li>\n<li><strong>Non-critical<\/strong>\n<p style=\"text-align:left\">\n      It can be loaded after the main page content.\n    <\/p>\n<\/li>\n<\/ul>\n<p>\n  In most cases, all styles are critical as you can see by default settings. But sometimes particular styles should be tuned individually.\n<\/p>\n<p><strong>Note.<\/strong> To <strong>disable styles processing<\/strong>, the next options should be disabled: all top level&#8217;s settings in &#8216;<a href=\"#general\">General<\/a>&#8216; and &#8216;<a href=\"#fonts\">Fonts<\/a>&#8216; blocks, &#8216;<a href=\".\/settings-images-accel#adapt\">Adaptation to screen sizes<\/a>&#8216; in &#8216;Images&#8217; and all <a href=\".\/settings-cdn-accel\">CDN items<\/a>.\n<\/p>\n<p style=\"text-align:center\">\n  <img decoding=\"async\" src=\"\/data\/content\/doc\/wordpress\/accelerator\/settings-styles-accel\/settings-styles-en.png\" alt=\"settings-Styles\" title=\"settings-Styles - Styles settings\" \/>\n<\/p>\n<h2><a id=\"general\"><\/a>General<br \/>\n<\/h2>\n<ul start=\"3\">\n<li><strong>Optimize loading<\/strong>\n<p style=\"text-align:left\">\n      Optimizing by inlining according to sub-options. Due to most styles are critical inlining increases page speed by decreasing request count to our server.\n    <\/p>\n<ul>\n<li><strong>Inline as source<\/strong>\n<p style=\"text-align:left\">\n          Insert style\u2019s body into <code>src<\/code> attribute instead of change it to <code>style<\/code> tag.\n        <\/p>\n<\/li>\n<li><strong>Inline critical<\/strong>\n      <\/li>\n<li><strong>Inline non-critical<\/strong>\n      <\/li>\n<li><strong>Delay non-critical with non-critical scripts<\/strong>\n      <\/li>\n<\/ul>\n<\/li>\n<li><strong>Group critical, group non-critical<\/strong>\n<p style=\"text-align:left\">\n      Grouping increases page speed by decreasing server request count but not all styles are compatible with such operation. If <a href=\"#not_critical_auto\">non-critical auto mode<\/a> is active then critical grouping is always safe.\n    <\/p>\n<ul>\n<li><strong>combine<\/strong>\n<p style=\"text-align:left\">\n          Combines styles into one block.\n        <\/p>\n<\/li>\n<li><strong>don&#8217;t combine<\/strong>\n<p style=\"text-align:left\">\n          Leaves each style in its own block.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Separate imports<\/strong>\n<p style=\"text-align:left\">\n      Extract and process styles that included in other styles by the <code>@import<\/code> directive.\n    <\/p>\n<\/li>\n<li><strong>Minify<\/strong>\n<p style=\"text-align:left\">\n      Optimizes CSS code to have a smaller size.\n    <\/p>\n<\/li>\n<li><strong>Fix structure<\/strong>\n<p style=\"text-align:left\">\n      Correction of incorrectly nested blocks.\n    <\/p>\n<\/li>\n<\/ul>\n<h2><a id=\"fonts\"><\/a>Fonts<br \/>\n<\/h2>\n<ul start=\"8\">\n<li><strong>Optimize loading<\/strong>\n<p style=\"text-align:left\">\n      Just adds CSS <code>font-display <\/code>attribute with one of the next values to fonts that <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/@font-face\/font-display\" rel=\"nofollow noopener\" target=\"_blank\">postpones their loading<\/a> and increase page content loading speed:\n    <\/p>\n<ul>\n<li><strong>auto<\/strong>\n<p style=\"text-align:left\">\n          The font display strategy is defined by the user agent.\n        <\/p>\n<\/li>\n<li><strong>block<\/strong>\n<p style=\"text-align:left\">\n          Gives the font face a short block period and an infinite swap period.\n        <\/p>\n<\/li>\n<li><strong>swap<\/strong> (default)\n<p style=\"text-align:left\">\n          Gives the font face an extremely small block period and an infinite swap period.\n        <\/p>\n<\/li>\n<li><strong>fallback<\/strong>\n<p style=\"text-align:left\">\n          Gives the font face an extremely small block period and a short swap period.\n        <\/p>\n<\/li>\n<li><strong>optional<\/strong>\n<p style=\"text-align:left\">\n          Gives the font face an extremely small block period and no swap period.\n        <\/p>\n<\/li>\n<\/ul>\n<p style=\"text-align:left\">\n      Also, font names can be specified: empty (for all names), font name part or <a href=\".\/regexp-accel\">regular expression<\/a>.\n    <\/p>\n<\/li>\n<li><strong>Separate from critical styles<\/strong>\n<p style=\"text-align:left\">\n      On some sites browser might incorrect render postponed fonts that declared in separate CSS file. It can be fixed by disabling this option.\n    <\/p>\n<ul>\n<li><strong>Group<\/strong>\n<p style=\"text-align:left\">\n          Grouping increases page speed by decreasing server request count but not all styles are compatible with such operation. <strong>Combining<\/strong> is the same as for <a href=\"#general\">the main styles<\/a>.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Deinline equal or larger<\/strong>\n<p style=\"text-align:left\">\n      Deinlines large fonts from CSS to decrease size.\n    <\/p>\n<\/li>\n<li><strong>Inline critical<\/strong>\n<p style=\"text-align:left\">\n      Inserts the bodies of the fonts specified in the list to load them as quickly as possible. Usually needed when there is<span style=\"font-size:12pt\"> <\/span>CLS<span style=\"font-size:12pt\"> <\/span>due to font loading. Regular expressions are allowed. Examples additions: <code>Helvetica Neue<\/code>, <code>@^Helvetica@<\/code>, <code>family:Helvetica Neue &amp; weight:700<\/code>, <code>family:@^Helvetica@ &amp; weight:@[4-7]00@ &amp; style:italic<\/code>.\n    <\/p>\n<\/li>\n<\/ul>\n<h2>\n  Non-critical<br \/>\n<\/h2>\n<ul>\n<li><a id=\"not_critical_auto\"><\/a><strong>Automatically<\/strong>\n<p style=\"text-align:left\">\n      Non-critical styles part will be automatically separated from critical ones. Also, specified CSS selectors can be excluded to be part of critical styles.\n    <\/p>\n<\/li>\n<li><strong>Manual<\/strong>\n<ul>\n<li><strong>Inlined<\/strong>\n<p style=\"text-align:left\">\n          Includes all inline styles.\n        <\/p>\n<\/li>\n<li><strong>Internal<\/strong>\n<p style=\"text-align:left\">\n          Includes all internal (self-hosted, hosted on our site) styles.\n        <\/p>\n<\/li>\n<li><strong>External<\/strong>\n<p style=\"text-align:left\">\n          Includes all external (hosted on the other sites) styles.\n        <\/p>\n<\/li>\n<li><strong>Exclude<\/strong>\n<p style=\"text-align:left\">\n          Styles with URLs, IDs, or bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will be treated as critical. It can be added multiple expressions at once by placing each on new line.\n        <\/p>\n<\/li>\n<li><strong>Include only<\/strong>\n<p style=\"text-align:left\">\n          Only styles with URLs, IDs, or bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will be treated as non-critical. It can be added multiple expressions at once by placing each on new line.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><a id=\"skip\"><\/a>Not needed<br \/>\n<\/h2>\n<p>\n  Styles with URLs, IDs, or bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will not be loaded. It can be added multiple expressions at once by placing each on new line.\n<\/p>\n<h2><a id=\"custom\"><\/a>Corrections for lazy loading scripts<br \/>\n<\/h2>\n<p>\n  On some sites layout is depended on scripts. So when <a href=\".\/settings-scripts-accel#general\">scripts loading are delayed<\/a>, then there may be necessary to adjust layout. It\u2019s a section for defining various styles to correct layout loading before <a href=\".\/settings-scripts-accel#general\">main scripts loading<\/a>. There are some already predefined elements related to particular site components, that can be used as a samples.\n<\/p>\n<p>\n  This styles are added to particular page only if <a href=\".\/settings-scripts-accel#general\">scripts delayed loading<\/a> is enabled, and page is not for <a href=\"https:\/\/amp.dev\/\" rel=\"nofollow noopener\" target=\"_blank\">AMP<\/a>.\n<\/p>\n<p>\n  It\u2019s a list of styles that will be added to the site by defined order. Each item has next options:\n<\/p>\n<ul start=\"3\">\n<li><strong>Enable<\/strong>\n<p style=\"text-align:left\">\n      It allows to disable item instead of deleting it.\n    <\/p>\n<\/li>\n<li><strong>Optional description to identify<\/strong>\n<p style=\"text-align:left\">\n      Allows to recognize the goal of specified styles. E.g. what particular problem it solves.\n    <\/p>\n<\/li>\n<li><strong>Style code<\/strong>\n<p style=\"text-align:left\">\n      The style code. Special body\u2019s class can be used in selectors to control styles\u2019 scope:\n    <\/p>\n<ul>\n<li><strong>seraph-accel-js-lzl-ing<\/strong>\n<p style=\"text-align:left\">\n          This class is removed from <code>body<\/code> tag when <a href=\".\/settings-scripts-accel#non_critical\">non-critical scripts<\/a> has been loaded and <a href=\".\/settings-scripts-accel#interact\">first click delay<\/a> is elapsed. So, it allows to apply styles only in scripts loading period plus enough time for their initialization.\n        <\/p>\n<\/li>\n<li><strong>seraph-accel-js-lzl-ing-ani<\/strong>\n<p style=\"text-align:left\">\n          See below about <a href=\"#custom_ani\">animation corrections<\/a>.\n        <\/p>\n<\/li>\n<li><strong>seraph-accel-view-XXX<\/strong>\n<p style=\"text-align:left\">\n          This class is added to the <code>body<\/code> tag when <a href=\".\/settings-views-accel\">views<\/a> are active. So, it allows to apply styles only in particular view, e.g. on mobiles only. <strong>XXX<\/strong> can be <code>cmn<\/code> (means common view, desktop) or particular slug like <code>mobile<\/code> from the <a href=\".\/settings-views-accel\">defined views<\/a>.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><a id=\"custom_ani\"><\/a>Animation corrections<br \/>\n<\/h3>\n<p>\n  There is a special class of <code>body<\/code> named <code>.seraph-accel-js-lzl-ing-ani<\/code>. It is added just after full content (DOM) is loaded and removed after <a href=\".\/settings-scripts-accel#interact\">specified time<\/a> after loading of a delayed <a href=\".\/settings-scripts-accel#non_critical\">non-critical scripts<\/a>. It allows to relay on that while creating correction styles.\n<\/p>\n<p>\n  Let&#8217;s take an example with<span style=\"font-size:12pt\"> <\/span>Elementor. Some of its elements have an initial style<span style=\"font-size:12pt\"> <\/span><code>.elementor-invisible<\/code>, when removed, the element appears smoothly on the screen. Because if this style is removed when non-critical scripts are running, then the appearance of the element occurs with a delay. To fix this, we can make an adjustment style like this:\n<\/p>\n<p><code class=\"p\">.elementor-invisible {<br \/><span style=\"font-size:9.5pt\">\t<\/span>visibility: visible !important;<br \/>}<\/code>\n<\/p>\n<p>\n  But in this case, we determine its visibility for the entire time the page is opened. This may conflict with logic in scripts. Those,\u00a0we need to make it active only at the initial display, until non-critical scripts are loaded. That&#8217;s why let&#8217;s do so:\n<\/p>\n<p><code class=\"p\">body.seraph-accel-js-lzl-ing .elementor-invisible {<br \/><span style=\"font-size:9.5pt\">\t<\/span>visibility: visible !important;<br \/>}<\/code>\n<\/p>\n<p>\n  Now everything seems to be fine. But if an animation is tied to removing this class, then it will not work, because class<span style=\"font-size:12pt\"> <\/span><code>.seraph-accel-js-lzl-ing<\/code><span style=\"font-size:12pt\"> <\/span>on the<span style=\"font-size:12pt\"> <\/span><code>body<\/code><span style=\"font-size:12pt\"> tag<\/span> added immediately. And this is where the class helps<span style=\"font-size:12pt\"> <\/span><code>.seraph-accel-js-lzl-ing-ani<\/code>, because it is not added immediately, but only after the entire page is loaded and the animation will be applied, because the corresponding elements will have their styles changed, which are included in the animation. Therefore,<span style=\"font-size:12pt\"> <\/span>we will correct so:\n<\/p>\n<p><code class=\"p\">body.seraph-accel-js-lzl-ing-ani .elementor-invisible {<br \/><span style=\"font-size:9.5pt\">\t<\/span>visibility: visible !important;<br \/>}<\/code>\n<\/p>\n<p><a href=\".\/settings-scripts-accel#interact\">The duration<\/a> of<span style=\"font-size:12pt\"> <\/span>the class deletion<span style=\"font-size:12pt\"> <\/span><span style=\"font-size:12pt\">delay <\/span><code>.seraph-accel-js-lzl-ing-ani<\/code> set to prevent double application of animation styles so that, for example, the element does not disappear and appears again after loading non-critical scripts. Those, during this time, the main scripts should execute their animation logic, which is already redefined by us.\n<\/p>\n<p><strong>Note.<\/strong> In rare cases to completely disable styles processing all top level checkboxes (in the first two sections), <a href=\".\/settings-cdn-accel#enabled\">CDN settings<\/a> and <a href=\".\/settings-images-accel#adapt\">images\u2019 adaptation to screen sizes<\/a> should be disabled.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Styles are separated into two categories: Critical It must be loaded before main page content to provide correct page rendering. Non-critical It can be loaded after the main page content. In most cases, all styles are critical as you can see by default settings. But sometimes particular styles should be tuned individually. Note. To disable&#8230;<\/p>\n","protected":false},"author":18,"featured_media":0,"parent":4812,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"rank_math_lock_modified_date":false},"categories":[816],"tags":[],"class_list":["post-4834","doc","type-doc","status-publish","hentry","category-accelerator"],"_links":{"self":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc\/4834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc"}],"about":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/types\/doc"}],"author":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/comments?post=4834"}],"up":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc\/4812"}],"wp:attachment":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/media?parent=4834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/categories?post=4834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/tags?post=4834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}