{"id":6119,"date":"2022-05-31T16:11:16","date_gmt":"2022-05-31T20:11:16","guid":{"rendered":"https:\/\/themespress.ca\/?p=6119"},"modified":"2022-08-23T07:45:35","modified_gmt":"2022-08-23T11:45:35","slug":"configuring-anchors-sticky-or-fixed","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/","title":{"rendered":"Configuring Anchors: Sticky or Fixed"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed.<\/p>\n<p>We found various ways to pull this off with CSS but we also found additional coding information on the web.<\/p>\n<p>The first thing required is that your fixed or sticky header needs to be measured in pixels to get an approximate height of your header.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Result of anchors with a fixed header.<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>We can clearly see in our example that the title is in the anchor. Logically, seeing as my ID is above it, we should land above the title.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"1903\" height=\"955\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01.png\" class=\"vc_single_image-img attachment-full\" alt=\"Param\u00e9trer des anchors \u2013 Ent\u00eate sticky ou fixed\" title=\"Screenshot 2022-05-31 at 15-51-01\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01.png 1903w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01-600x301.png 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01-300x151.png 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01-1024x514.png 1024w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01-768x385.png 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01-1536x771.png 1536w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-15-51-01-1320x662.png 1320w\" sizes=\"(max-width: 1903px) 100vw, 1903px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >CSS for your sticky or fixed header<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>You need to make sure to add the following CSS value: top:0. It&#8217;s this value that will position perfectly your anchor at the right spot.<\/p>\n<p>The problem with headers configured with a sticky or fixed position is that the anchor doesn&#8217;t always land where you want it to be given there&#8217;s a gap caused by the pixel height of the header.<\/p>\n<p>Here our HTML body needs to have the sticky CSS while the header needs position and top.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-5622572\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-5622572\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"css\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">body.stiky header {\n  position: sticky;\n  background: #fff;\n  z-index: 3;\n  width: 100%;\n  left: 0;\n  top: 0;\n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>We then found this helpful code which will fix the gap issue.<\/p>\n<p><strong>In our example, the height of our header is 215px.<\/strong><br \/>\nOFFSET_HEIGHT_PX: 215,<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1654028270519\" >Javascript to add in the footer<\/h2><div id=\"ts-enlighterjs-container-6189071\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-6189071\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"javascript\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">&lt;script&gt;\n(function(document, history, location) {\n  var HISTORY_SUPPORT = !!(history &amp;&amp; history.pushState);\n\n  var anchorScrolls = {\n    ANCHOR_REGEX: \/^#[^ ]+$\/,\n    OFFSET_HEIGHT_PX: 215,\n\n    \/**\n     * Establish events, and fix initial scroll position if a hash is provided.\n     *\/\n    init: function() {\n      this.scrollToCurrent();\n      $(window).on(&#039;hashchange&#039;, $.proxy(this, &#039;scrollToCurrent&#039;));\n      $(&#039;body&#039;).on(&#039;click&#039;, &#039;a&#039;, $.proxy(this, &#039;delegateAnchors&#039;));\n    },\n\n    \/**\n     * Return the offset amount to deduct from the normal scroll position.\n     * Modify as appropriate to allow for dynamic calculations\n     *\/\n    getFixedOffset: function() {\n      return this.OFFSET_HEIGHT_PX;\n    },\n\n    \/**\n     * If the provided href is an anchor which resolves to an element on the\n     * page, scroll to it.\n     * @param  {String} href\n     * @return {Boolean} - Was the href an anchor.\n     *\/\n    scrollIfAnchor: function(href, pushToHistory) {\n      var match, anchorOffset;\n\n      if(!this.ANCHOR_REGEX.test(href)) {\n        return false;\n      }\n\n      match = document.getElementById(href.slice(1));\n\n      if(match) {\n        anchorOffset = $(match).offset().top - this.getFixedOffset();\n        $(&#039;html, body&#039;).animate({ scrollTop: anchorOffset});\n\n        \/\/ Add the state to history as-per normal anchor links\n        if(HISTORY_SUPPORT &amp;&amp; pushToHistory) {\n          history.pushState({}, document.title, location.pathname + href);\n        }\n      }\n\n      return !!match;\n    },\n    \n    \/**\n     * Attempt to scroll to the current location&#039;s hash.\n     *\/\n    scrollToCurrent: function(e) { \n      if(this.scrollIfAnchor(window.location.hash) &amp;&amp; e) {\n      \te.preventDefault();\n      }\n    },\n\n    \/**\n     * If the click event&#039;s target was an anchor, fix the scroll position.\n     *\/\n    delegateAnchors: function(e) {\n      var elem = e.target;\n\n      if(this.scrollIfAnchor(elem.getAttribute(&#039;href&#039;), true)) {\n        e.preventDefault();\n      }\n    }\n  };\n\n\t$(document).ready($.proxy(anchorScrolls, &#039;init&#039;));\n})(window.document, window.history, window.location);\n&lt;\/script&gt;<\/pre><\/div><h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1654028345080\" >Final result with the anchor<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>We see that the anchor is positioned exactly where the ID is, i.e. above the title.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"1903\" height=\"955\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code.png\" class=\"vc_single_image-img attachment-full\" alt=\"Avec le code\" title=\"Screenshot 2022-05-31 at 16-02-26 - Avec le code\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code.png 1903w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code-600x301.png 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code-300x151.png 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code-1024x514.png 1024w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code-768x385.png 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code-1536x771.png 1536w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Screenshot-2022-05-31-at-16-02-26-Avec-le-code-1320x662.png 1320w\" sizes=\"(max-width: 1903px) 100vw, 1903px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1654028555007\" >Slide effect on the anchor<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>You can also add a slide effect that drops the ID towards the anchor.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-9181777\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-9181777\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"css\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">html {scroll-behavior: smooth;}<\/pre><\/div><\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":6010,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[],"class_list":["post-6119","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Share the post &quot;Configuring Anchors: Sticky or Fixed&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Daniel\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Themespress - Des tutoriels et ressources WordPress\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Configuring Anchors: Sticky or Fixed - Themespress\" \/>\n\t\t<meta property=\"og:description\" content=\"Share the post &quot;Configuring Anchors: Sticky or Fixed&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2022-05-31T20:11:16-04:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-08-23T11:45:35-04:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Configuring Anchors: Sticky or Fixed - Themespress\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Share the post &quot;Configuring Anchors: Sticky or Fixed&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#blogposting\",\"name\":\"Configuring Anchors: Sticky or Fixed - Themespress\",\"headline\":\"Configuring Anchors: Sticky or Fixed\",\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Parametrer-des-anchors-Entete-en-position-sticky-ou-fixed-scaled.jpg\",\"width\":2560,\"height\":1280,\"caption\":\"Param\\u00e9trer des anchors - Ent\\u00eate en position sticky ou fixed\"},\"datePublished\":\"2022-05-31T16:11:16-04:00\",\"dateModified\":\"2022-08-23T07:45:35-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#webpage\"},\"articleSection\":\"Tutorials, Optional\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#listItem\",\"name\":\"Configuring Anchors: Sticky or Fixed\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"name\":\"Accueil\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#listItem\",\"position\":3,\"name\":\"Configuring Anchors: Sticky or Fixed\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/\",\"name\":\"Daniel\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Daniel\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#webpage\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/\",\"name\":\"Configuring Anchors: Sticky or Fixed - Themespress\",\"description\":\"Share the post \\\"Configuring Anchors: Sticky or Fixed\\\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Parametrer-des-anchors-Entete-en-position-sticky-ou-fixed-scaled.jpg\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#mainImage\",\"width\":2560,\"height\":1280,\"caption\":\"Param\\u00e9trer des anchors - Ent\\u00eate en position sticky ou fixed\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/configuring-anchors-sticky-or-fixed\\\/#mainImage\"},\"datePublished\":\"2022-05-31T16:11:16-04:00\",\"dateModified\":\"2022-08-23T07:45:35-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Configuring Anchors: Sticky or Fixed - Themespress","description":"Share the post \"Configuring Anchors: Sticky or Fixed\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information","canonical_url":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#blogposting","name":"Configuring Anchors: Sticky or Fixed - Themespress","headline":"Configuring Anchors: Sticky or Fixed","author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Parametrer-des-anchors-Entete-en-position-sticky-ou-fixed-scaled.jpg","width":2560,"height":1280,"caption":"Param\u00e9trer des anchors - Ent\u00eate en position sticky ou fixed"},"datePublished":"2022-05-31T16:11:16-04:00","dateModified":"2022-08-23T07:45:35-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#webpage"},"isPartOf":{"@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#webpage"},"articleSection":"Tutorials, Optional"},{"@type":"BreadcrumbList","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","position":1,"name":"Accueil","item":"https:\/\/themespress.ca\/en\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","position":2,"name":"Tutorials","item":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#listItem","name":"Configuring Anchors: Sticky or Fixed"},"previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","name":"Accueil"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#listItem","position":3,"name":"Configuring Anchors: Sticky or Fixed","previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}}]},{"@type":"Organization","@id":"https:\/\/themespress.ca\/en\/#organization","name":"Themespress","description":"Des tutoriels et ressources WordPress","url":"https:\/\/themespress.ca\/en\/"},{"@type":"Person","@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author","url":"https:\/\/themespress.ca\/en\/author\/daniel\/","name":"Daniel","image":{"@type":"ImageObject","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g","width":96,"height":96,"caption":"Daniel"}},{"@type":"WebPage","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#webpage","url":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/","name":"Configuring Anchors: Sticky or Fixed - Themespress","description":"Share the post \"Configuring Anchors: Sticky or Fixed\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/themespress.ca\/en\/#website"},"breadcrumb":{"@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#breadcrumblist"},"author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"creator":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Parametrer-des-anchors-Entete-en-position-sticky-ou-fixed-scaled.jpg","@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#mainImage","width":2560,"height":1280,"caption":"Param\u00e9trer des anchors - Ent\u00eate en position sticky ou fixed"},"primaryImageOfPage":{"@id":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/#mainImage"},"datePublished":"2022-05-31T16:11:16-04:00","dateModified":"2022-08-23T07:45:35-04:00"},{"@type":"WebSite","@id":"https:\/\/themespress.ca\/en\/#website","url":"https:\/\/themespress.ca\/en\/","name":"Themespress","description":"Des tutoriels et ressources WordPress","inLanguage":"en-US","publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"Themespress - Des tutoriels et ressources WordPress","og:type":"article","og:title":"Configuring Anchors: Sticky or Fixed - Themespress","og:description":"Share the post &quot;Configuring Anchors: Sticky or Fixed&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information","og:url":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/","article:published_time":"2022-05-31T20:11:16-04:00","article:modified_time":"2022-08-23T11:45:35-04:00","twitter:card":"summary","twitter:title":"Configuring Anchors: Sticky or Fixed - Themespress","twitter:description":"Share the post &quot;Configuring Anchors: Sticky or Fixed&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will show you how to configure anchors at the perfect height with either position sticky or fixed. We found various ways to pull this off with CSS but we also found additional coding information"},"aioseo_meta_data":{"post_id":"6119","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"Article","defaultPostTypeGraph":""},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"},\"blockGraphs\":[]}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-08-23 11:21:46","updated":"2025-06-08 01:46:06","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/\" title=\"Accueil\">Accueil<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/categorie\/tutorials\/\" title=\"Tutorials\">Tutorials<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tConfiguring Anchors: Sticky or Fixed\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Accueil","link":"https:\/\/themespress.ca\/en\/"},{"label":"Tutorials","link":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/"},{"label":"Configuring Anchors: Sticky or Fixed","link":"https:\/\/themespress.ca\/en\/configuring-anchors-sticky-or-fixed\/"}],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=6119"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6119\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/6010"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=6119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=6119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=6119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}