4
15 Comments

How to make a fixed header on Carrd?

So I saw Martin doing something like this, got very inspired and even tough im a little bit early in my css course I decide to give it a shot. It seems to kinda work but the widht isnt covering the full page and the container isnt taking a space in the page (it is floating). I suspect that it has something to do with HTML but cant figure out what.

this is the page

https://dwellhouse.carrd.co/

and here is the code

position: fixed;
padding-top: 8%;
background-color: #FFF;
z-index: +1;
width: 100%;

Any ideas? 🤔

  1. 1

    Very cool to see how you built on top of the https://arestaurant.carrd.co template! :D

    The navbar looks good, but there's still a bit of a hack in the beginning when you scroll down. I had this problem for a long time also, but asked my developer friend to fix the code a bit, you can see the result here in a Carrd template that I made:
    https://getclockwise.carrd.co/

  2. 1

    It work very well in my phone, but only in landscape! Did you figured out or it’s the same css as the example?

  3. 1

    Looks like you got it working. What did the trick?

    1. 2

      Judging by the code there is this custom css that overrides the card css with the !important property for the header

      dwelhouse css

      #header.sticky {
      position: fixed !important;
      top: 0;
      width: 100% !important;
      background: #806DE8;
      z-index: 9999;
      margin-left: 0 !important;
      left: 0 !important;
      }

      clockwise

      #header.sticky {
      position: fixed !important;
      top: 0rem;
      width: 100% !important;
      background: #fff;
      z-index: 9999;
      margin-left: 0 !important;
      left: 0 !important;
      }

      @rustyy if you still have issues let me know I'll give it a shot

      1. 1

        Hi! I've been trying to do this too and it's also not filling the width, despite using 100% !important;

        any ideas?

        1. 1

          is your code somewhere where I can look at it?

          1. 1

            Hi, I've also tried this code and it doesn't fill the width. Any ideas? I used this code

            position: fixed !important;
            top: 0;
            width: 100% !important;
            background: #806DE8;
            z-index: 9999;
            margin-left: 0 !important;
            left: 0 !important;

            position: fixed !important;
            top: 0rem;
            width: 100% !important;
            background: #fff;
            z-index: 9999;
            margin-left: 0 !important;
            left: 0 !important;

            thanks!

            1. 1

              I'm sorry, but I can't say from that snippet I would need to see the entire site.

                1. 1

                  the position of the code seems to be at the wrong place.

                  Wrapper

                  Try to put the code further up, so that it is within the main div wrapper.

                  1. 2

                    Thanks! It works great now.

                    1. 1

                      Nice to hear that 👏🏽

                  2. 1

                    the only thing I'd add is that when it loads you see the header in the middle and not full width, and then a few seconds, and then it displays nicely full width. I don't know if anything can stop that jump happening?

                    1. 1

                      It has to do with the animation.

                      The animation for some reason blocks the header from stretching.

                      try to

                      1. take out the animation from the whole page see if it works

                      2. try to add "is-ready" to the class of the header

  4. 1

    This comment was deleted 3 years ago.

Trending on Indie Hackers
After 10M+ Views, 13k+ Upvotes: The Reddit Strategy That Worked for Me! 42 comments Getting first 908 Paid Signups by Spending $353 ONLY. 24 comments I talked to 8 SaaS founders, these are the most common SaaS tools they use 20 comments What are your cold outreach conversion rates? Top 3 Metrics And Benchmarks To Track 19 comments Hero Section Copywriting Framework that Converts 3x 12 comments Join our AI video tool demo, get a cool video back! 12 comments