How to Create a Sticky Header in the Free Version of Astra with CSS (NO PRO, NO PLUGIN)

Поділитися
Вставка
  • Опубліковано 21 жов 2024

КОМЕНТАРІ • 181

  • @cgswebdesigns
    @cgswebdesigns  3 роки тому +6

    For those wondering - the blog post in the description contains the CSS code updated for Astra version 3.0.

  • @myrinaDM
    @myrinaDM Рік тому +1

    Thank you for helping us! Even with the current updates, one can assemble the code however they want, based on your instructions. 🤘

  • @ianharding3514
    @ianharding3514 11 місяців тому

    Excellent tutorial. I had found the code on your website but it didn't work. Seeing this video showed me what to change (.site-header change to .main-header-bar) and it works beautifully, AND I now have the added advantage of seeing how it works. Thank you so much!

  • @MrFlamerFuel
    @MrFlamerFuel 3 роки тому +1

    This works. CCS class for me is "main-header-bar-wrap" but the same for everything else. ty.

  • @reikodang5519
    @reikodang5519 4 роки тому +3

    I'm super new to building website. This was so clear for someone like me. Thank you!

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      I'm glad you liked it. Thanks for watching!

  • @Injineerka2
    @Injineerka2 3 місяці тому

    Why I am seeing this video after 3 years? Why?
    Thank you bro. Subscribed, liked and will will probably bookmark your channel.

  • @saramclaughlin7402
    @saramclaughlin7402 Рік тому

    Thank you sooooo much, this is all I needed! And I especially appreciate you updating the blog too!

    • @cgswebdesigns
      @cgswebdesigns  Рік тому

      Thanks so much for watching and commenting! I'm glad you got what you needed.

  • @marioraetzel
    @marioraetzel Рік тому

    Thank you very much for the code. One question: did you put your mic right on the table? Because you can hear every move of your mouse

  • @diariodiunpapàingiappone
    @diariodiunpapàingiappone 4 роки тому +3

    Thank you for your precious video.
    I changed top 0 to 1.
    Perfect!
    Grazie!

  • @mauriziotocchioni4841
    @mauriziotocchioni4841 2 роки тому +2

    Coincise and perfectly understandable, thank you for sharing your knowledge!

    • @cgswebdesigns
      @cgswebdesigns  2 роки тому +1

      Thanks! I'm glad it was useful for you!

  • @TooMuchIntensity
    @TooMuchIntensity 10 місяців тому

    YOU'RE A LIFESAVER ILY

  • @free2idol1
    @free2idol1 3 роки тому

    thank you and have a nice day!!! will remember to buy via your affiliate link when I need a pro version...

  • @mansbestfriend9632
    @mansbestfriend9632 4 роки тому +1

    Thank you. Been looking for this for a while

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      Thanks for watching, glad it provided some value to you!

  • @CarlosAstudillo
    @CarlosAstudillo Рік тому

    Working in 2023. Thanks a lot

  • @SinhalaMathsGuide
    @SinhalaMathsGuide 3 роки тому

    Thank you very much for this. Actually I am lucky to see this. Please do more videos. It is very clear and easily understandable without any long unnecessary contents.

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      Thanks for watching, I'm glad it was helpful!

  • @terrawattco
    @terrawattco 11 місяців тому

    Hi, this is great! But it is for a post right? It is not working for me as mine is a page. Is there any way to do for that too?

  • @ronstopchycki8086
    @ronstopchycki8086 Рік тому

    Thank you for this great info!
    Is it possible to have only the "primary menu" of the header sticky and not the "below menu?"

  • @nini851
    @nini851 Рік тому

    Thank you, the tutorial is easy to understand, I tried and it works perfectly !

  • @gilataph2848
    @gilataph2848 2 роки тому

    Great tutorial and it works for me. what I need to do is, I have a above header and when you scroll down, only the main header will remain sticky and the above header will be pushed above?
    I hope you'll help me with this. Thanks!

    • @cgswebdesigns
      @cgswebdesigns  Рік тому

      You would need some Javascript code in order to detect the scrolling. Unfortunately, I don't know how to do that just yet. :(

  • @sujithsukumaran4268
    @sujithsukumaran4268 4 роки тому +2

    Thank you and you are awesome

  • @m1lhau777x
    @m1lhau777x 8 місяців тому

    Great tutorial, does anyone know how to make header shrink on scroll down?

  • @brakwameh6264
    @brakwameh6264 2 роки тому

    Fantastic! Can you please make a video showing how I make it fully transparent then when i scroll its semi or not transparent anymore after a length of scroll?

    • @cgswebdesigns
      @cgswebdesigns  Рік тому

      Hi, thanks for checking out the article! In order to make the style change on scroll, you would need to write some Javascript code. Unfortunately, I'm not very good with that :/ Sorry!

  • @kjarra
    @kjarra 6 місяців тому

    Really helpful and clear thank you !

  • @BishwajitChakrabortyy
    @BishwajitChakrabortyy 3 роки тому +1

    This works fine in the desktop version. In case of mobile the menu doesn't scroll down. When I press the toggle button the menu still comes at the top of the page only. Help please.

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      Thank you for commenting. The code is set for Astra as it is on the default installation, I just checked again on my test site and the code is still valid on a fresh Astra free installation. However, if you're using other Astra features such as the Custom Headers or you've installed one of their starter templates, you may need to inspect your header elements in the html code to see what CSS selectors to target.

  • @emirk8064
    @emirk8064 2 роки тому

    Thank you!!! It works, and I'm very grateful to you!

  • @VictoriaAlfredSmythe
    @VictoriaAlfredSmythe 2 роки тому +1

    thank you

  • @HafizRahmanBD
    @HafizRahmanBD 4 роки тому +1

    You are a life saver brother. Thank you so much.

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      Thanks for watching! I’m glad you got what you needed from it.

  • @johnsonliu9851
    @johnsonliu9851 3 роки тому

    Hi, thank you for making the tutorial and sharing the codes, it works perfectly in 3 different devices. Great Job!

  • @СергейМартынов-ы9ъ

    The best solution ever
    Thanks man!

  • @tomito78600
    @tomito78600 3 роки тому +1

    you made my day man! Thanxs a lot!

  • @birgitwest143
    @birgitwest143 2 роки тому

    Thank you! That was so helpful, and so quick!

  • @kashaffarooq8207
    @kashaffarooq8207 2 роки тому

    It's working! Thank you.

  • @reneedocktor
    @reneedocktor 10 місяців тому

    Thank you so much; you've been a great help

  • @jjmovingsolutions
    @jjmovingsolutions Рік тому

    howdy, any idea why this wouldnt work? I followed the instructions and the header is not sticky

  • @satpalsinghrathore2665
    @satpalsinghrathore2665 3 роки тому +1

    How to keep sticky header only for desktop? I don't want the sticky header for smaller screens.

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      You can use media queries in your CSS code the same way we adjust the padding for different screen sizes.

  • @wingsluxe
    @wingsluxe Рік тому

    YOU ARE AMAZING. Thank you

    • @cgswebdesigns
      @cgswebdesigns  Рік тому

      Thank you for such a nice comment! It's highly appreciated :-)

  • @micheledekormicomsolutions3604
    @micheledekormicomsolutions3604 4 роки тому

    Thank you so much !
    Your video was amazing clear. XXxx from France

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      Thanks for watching, I'm glad you got some value out of it!

  • @DSPplug
    @DSPplug 3 роки тому +1

    Thanks, useful

  • @Aticap
    @Aticap 4 роки тому +2

    thank you for saving me a ton of time!

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      You're welcome, I'm glad you got something of value from the video :-)

  • @titusisrael3554
    @titusisrael3554 4 роки тому +1

    keep up the good work. Nice

  • @BenchBear225
    @BenchBear225 Рік тому

    Wow, super helpful!

  • @fayounguhie3378
    @fayounguhie3378 2 роки тому

    Thank you, man. So helpful

  • @esteticasemprebella201
    @esteticasemprebella201 3 роки тому

    Thank you!!!!!!! This video is gold!

  • @dr.mathiasbabel8120
    @dr.mathiasbabel8120 4 роки тому +1

    Great job!
    Thank you very much.

  • @1fighisimo
    @1fighisimo 4 роки тому +1

    thank you so much for this insight!

  • @vikaskushwah6813
    @vikaskushwah6813 3 роки тому +1

    Great job!
    Thank you so much :)

  • @katharina2669
    @katharina2669 3 роки тому

    thank you so much!! even i as a wordpress beginner could handle this:)

  • @delphiniummarketing
    @delphiniummarketing Рік тому

    Thank you!

  • @agatafratczak3416
    @agatafratczak3416 4 роки тому +1

    That`s very usefull. Good job! Thank you so much!

  • @satpalsinghrathore2665
    @satpalsinghrathore2665 3 роки тому

    Anchor links are not working nicely with the new transparent sticky header of Astra theme. It hides some of the text due to the header. Can you provide the code to solve this problem?
    I am using Astra free version and used your code to make it sticky.

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      Hey thanks for watching, I'm not actually sure how to make that happen. Since this code is applied to the Astra free version, the container and .js adjustments that make it smooth in the premium version don't come in to play. You can check here for possible answers: stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header

  • @herypangestu6976
    @herypangestu6976 4 роки тому +1

    Thank thank you so much

  • @ronnhogann6246
    @ronnhogann6246 3 роки тому +1

    Thanks! ; )

  • @majdapazman845
    @majdapazman845 3 роки тому

    Hi, Sharif, this was awesome thank you!
    One question tho - I have a free version of Astra and am currently building my website. I cannot find where to change the look of the drop down Menu that comes from the main navigational menu. for example: when I hover over 'services' the drop down menu looks horrible - it is some kind of a bubble and i want to change it but don't know where. (I googled as well, still couldn't find it). Anyway, I would really appreciate if you could help :)

    • @cgswebdesigns
      @cgswebdesigns  2 роки тому +1

      Hi, sorry I missed this question or I would have gotten a reply to you sooner. In Astra free it's pretty limited, but you should be able to find settings in the Header Builder section of the Customizer. Drop the Primary Menu widget into the Header Builder and then select the widget and click the DESIGN tab. That will give you the configurable options that are available. If you know CSS, you can also target the .sub-menu CSS class for your own customizations.

  •  3 роки тому

    Great video!! Thank you a lot! ;)

  • @anomthomas1781
    @anomthomas1781 2 роки тому

    very nice video you deserve like dear

  • @drjimbarnes
    @drjimbarnes 4 роки тому +1

    I've tried your CSS code on the Astra Mountain template and the menu is sticky, but the background stays transparent no matter what colour or opacity I try in the last bit of your CSS code. It's a transparent header when inspect the style. Any way of making a sticky white background behind the sticky menu items?

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому +3

      Thanks for watching. When I originally made this video, transparent header was a premium feature but now they have it in the free version which means it has its own class - I've never used that template myself, but looking at the example from Astra's Starter Websites it looks like you can target their transparent header class with something like this:
      .ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar {
      border-bottom-width: 0;
      border-bottom-style: solid;
      border-bottom-color: rgba(0,0,0,0);
      background: #FFFFFF;
      position: fixed;
      width: 100%;
      }
      The last 3 lines are the ones I added in developer mode in Chrome and that made the header solid white, sticky, and stretched to the full width of the page.

    • @drjimbarnes
      @drjimbarnes 4 роки тому

      CGS Investments LLC Thanks a lot! That’s great of you to go tot the trouble. 🤗

    • @elladitch9698
      @elladitch9698 4 роки тому

      @@cgswebdesigns Thank you SO MUCH!! Really appreciate your help!!! You are the best!!!

  • @aldeonyazlm1809
    @aldeonyazlm1809 4 роки тому

    Thank you bro its really help

  • @Hipknotic_Designs
    @Hipknotic_Designs 4 роки тому

    Hi, thanks so much for this tutorial, you explain things brilliantly. I'm not quite looking for a sticky header, i like the transparent look, but i want the header to shrink when people scroll, so the header remains at the top, with the menus still visible as they scroll. Does this make sense? I think it's on scroll effect.

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      Thanks for watching!

    • @SoftwareBasics
      @SoftwareBasics 3 роки тому

      I think this is what you're looking for: ua-cam.com/video/uIZz3ZpU7gU/v-deo.html
      It'll make your header sticky and shrink while scrolling.

  • @reynaldolunaroblero1057
    @reynaldolunaroblero1057 4 роки тому +1

    Excelente Vídeo. Me funciono muchas gracias por tu aporte. Saludos desde México!

  • @UDOY999
    @UDOY999 Місяць тому

    Thanks ❤

  • @daysofimalka
    @daysofimalka 3 роки тому

    Thankyou! I did it.❤️

  • @MrAlbashiri
    @MrAlbashiri 3 роки тому

    Thank you so much.

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      You're welcome! Glad it was of use to you :-)

  • @jenithajeyakumar105
    @jenithajeyakumar105 2 роки тому

    Superrrrr thanks very muchhhhhh

  • @onlineclub.
    @onlineclub. 3 роки тому +1

    Thanks bro

  • @gquadoffice8123
    @gquadoffice8123 3 роки тому

    thank you so much!!!!!

  • @callumyaw1203
    @callumyaw1203 3 роки тому

    Hi there, thanks for making this video. I've copy and pasted the code for the Astra 3.0 Header Builder into the Additional CSS section of my site, but the sticky header is not working. All that happens is adding a frustrating 1px line underneath my header without it being sticky. Also the page is private and not published.
    Do you have any suggestions for where I may be going wrong?

    • @callumyaw1203
      @callumyaw1203 3 роки тому

      I just used the beginning of the code and it worked but there's still issues with it sticking on responsive sizes, mobile in particular
      /*Make Header Sticky - for Astra 3.0 and later*/
      .site-header {
      position: fixed;
      width: 100%;
      }

    • @euliziliskawafune7096
      @euliziliskawafune7096 3 роки тому +2

      @@callumyaw1203 Hi Friend, I had the same problem. I resolved with this code:
      .main-header-bar {
      position: fixed;
      top: 100;
      width: 100%;
      }
      .ast-mobile-header-content
      {
      position: fixed;
      top: 0;
      padding-top: 100px;
      width: 100%;
      }
      You will need to adjust the padding-top to the size of your menu. I hope it helps you

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      Thank you for commenting. The code is set for Astra as it is on the default installation, I just checked again on my test site and the code is still valid on a fresh Astra free installation. However, if you're using other Astra features such as the Custom Headers or you've installed one of their starter templates, you may need to inspect your header elements in the html code to see what CSS selectors to target.

    •  3 роки тому +1

      @@euliziliskawafune7096 You, yes, you... You are a lifesaver. You... yes, you have to know that. The second line helps me a lot with my page. I had a problem with the submenu that didn't appear in the mobile. but with your second line of code, it works!!! Thanks so much and May the Force be with you...

    • @euliziliskawafune7096
      @euliziliskawafune7096 3 роки тому +1

      @ Your welcome and also May the Force be with you... 😁

  • @basantsingh7943
    @basantsingh7943 3 роки тому

    Thanks dude 😎

  • @vetmedicinae887
    @vetmedicinae887 4 роки тому

    Work, thank you :O

  • @muhammedgad1536
    @muhammedgad1536 3 роки тому

    Hi, could you please help
    what if i want it transparent on top but when i scroll it becomes opaque.
    or how to make the very top post come in front of the header, i tried changing z-index of top post but couldn't reach header z index
    Thank you

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      Thanks for watching and visiting my channel. Unfortunately as I have dug into the theme code for Free Astra, it doesn’t appear there is separate selector built-in for changing the color of the header after scroll. Even the Pro version of Astra doesn’t apply a scroll property - the Pro theme accomplishes the task using two separate headers, one of which is hidden based on the current scroll position.

    • @satpalsinghrathore2665
      @satpalsinghrathore2665 3 роки тому

      @@cgswebdesigns In the latest Astra free version, the header by default is transparent. When I used your code to create sticky header it didn't worked well with "Table of Content" links. The transparent header cause the position to move below where it should be.
      Example: Visit this link: financevidhya.com/ppf-nps/
      Click on "Table of Content links " or the "Subscribe" button in the header.
      Can you suggest the code to remove transparent header? I want a solid header. I tried disabling it using Astra options but it didn't worked. May be your code overrides it. Thanks.

  • @rajon_kobir
    @rajon_kobir 4 роки тому +1

    Grazie!

  • @mynetwork3699
    @mynetwork3699 4 роки тому

    great work

  • @ishized88
    @ishized88 4 роки тому

    Try to click the link on the description above but I was denid access. can you help! Thanks

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      What country are you accessing the site from?

  • @myrainys
    @myrainys 4 роки тому

    Great. Tak!

  • @HilalKhan-rq6bh
    @HilalKhan-rq6bh 4 роки тому

    lovable gift for us, Thank you so much. big like and subscribe.

  • @AbdullahAshraff
    @AbdullahAshraff 3 роки тому

    how can I do this for the blog site only ?

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      You could try using the blog selector... try using the same code but add .blog to the beginning of the CSS selector for the elements.

  • @heyitsblissful1158
    @heyitsblissful1158 3 роки тому

    Can i use this for free elementor version? Does it apply to all website?

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      I haven't tested it on a site running Elementor, it might work though.

  • @ricardoaguiar2522
    @ricardoaguiar2522 4 роки тому

    Olá. Você pode liberar o código css do Sticky Menu Astra? Por favor. Parece-me que seu blog está fora do ar. Obrigado!!! I am fron Brazil.

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому +1

      I'm sorry, I have Brazil blocked via Cloudflare due to the amount of malicious traffic hitting my blog from there. The code is visible in the video. Please check out this code on PasteBin: pastebin.com/A7nbA6jj it is set to expire so I don't have to keep changing it there when Astra changes theme code.

    • @ricardoaguiar2522
      @ricardoaguiar2522 4 роки тому

      @@cgswebdesigns
      It's all right. I teased the code of the video. thanks for sending the code link.

    • @estebanrodriguez5820
      @estebanrodriguez5820 4 роки тому

      @@ricardoaguiar2522 Nao consigo ver o codigo. tem como me passar por favro

  • @violeta4558
    @violeta4558 4 роки тому

    How to increase the font of the main menu in the header with an Astra theme for free?

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      You may just be able to add: font-size: 24px; to the same CSS IDs I used in the video.

  • @estebanrodriguez5820
    @estebanrodriguez5820 4 роки тому

    I can´t enter to the site to see the code. Can you send me please.... Thanks

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      I changed up my Cloudflare settings, you should be able to get to it now.

  • @wasimmomin8409
    @wasimmomin8409 4 роки тому

    your website as for spam verification and nothing happens just the same thing again and agani

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      I apologize for that. I have a security verification provided by Cloudflare which challenges traffic coming from countries that generate the most attacks on websites, these countries include Brazil, Russa, China, & India. If you're in one of these countries you'll need to pass the verification to see the site. If you can't pass the verification, you'll need to try a different web browser that's up to date and secure.

  • @karankrash9033
    @karankrash9033 3 роки тому +1

    not working bro

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому +1

      I've tested this today with a fresh installation of the latest Astra theme, with no additional plugins, and the code still works. If you have additional configuration or plugins overriding the CSS then you may have different results.

  • @iamdaudkhan
    @iamdaudkhan 4 роки тому +1

    helpfull

  • @lajisjourney3241
    @lajisjourney3241 4 роки тому

    Not working after latest update of astra theme. please help.

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому +1

      I checked it again on the latest version today and it still works. Exactly the same code on a fresh Astra theme. If you have installed an Astra site template, this may not be the case as their templates include other header functions that may override this.

    • @lajisjourney3241
      @lajisjourney3241 4 роки тому +1

      It is working now...thanks a lot.
      Just one more question. Will this code work in ocean wp theme also or do we need different codes for different themes?

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      @@lajisjourney3241 You'll probably need different code. in Google Chrome, if you right click the header in OceanWP and choose "inspect" you can search out the CSS IDs of the header and try the code with that replaced to see if it works.

  • @leonkambarami8091
    @leonkambarami8091 Рік тому

    Where is the CSS code?

    • @cgswebdesigns
      @cgswebdesigns  Рік тому

      The link is in the description of the video - I keep the code updated on the link since I sometimes have to adjust it after Astra updates. The latest working version will always be at the link in the description.

  • @Sankalpabuddhi
    @Sankalpabuddhi 4 роки тому +1

    *copy paste this*
    /*Make Header Sticky*/
    .main-header-bar {
    position: fixed;
    top: 0;
    width: 100%;
    }

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      Thanks for watching :-) I didn't post the actual code here because as theme versions change, the code required is likely to change. My blog post has the latest version.

  • @ambayagya
    @ambayagya 3 роки тому

    please do it in astra 3.0 free also please

    • @cgswebdesigns
      @cgswebdesigns  3 роки тому

      I tested this today with the latest version of Astra and it still works.

  • @vidya__bhushan
    @vidya__bhushan 4 роки тому

    Your blog taking too long to open.

    • @vidya__bhushan
      @vidya__bhushan 4 роки тому

      Btw it helped a lot. Thankyou from INDIA!

    • @cgswebdesigns
      @cgswebdesigns  4 роки тому

      @@vidya__bhushan Thanks for hanging in there! I have some firewall rules applied to traffic from India because I get a lot of bots from there. I'm sorry that it slowed down your experience but I very much appreciate your feedback. :-)

  • @unknownman1
    @unknownman1 Рік тому

    not working anymore

    • @cgswebdesigns
      @cgswebdesigns  Рік тому

      I just tested the current code on my test site and it's still accurate. You may need to double check you're using the code I posted in my blog - that's where I keep the code updated when Astra makes changes that require me to make adjustments. Also, if you're using an Astra site template from their collection of pre-built sites, some of them use different header options that negate the base code and you'll have to adjust it.

  • @nourchaer
    @nourchaer 3 роки тому

    thank you so much

  • @nassoss1
    @nassoss1 4 роки тому

    Thank you!!!