Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. full width space in navbar / menu and evenly distribute menu items to fill out whole navbar

full width space in navbar / menu and evenly distribute menu items to fill out whole navbar

Scheduled Pinned Locked Moved General Discussion
13 Posts 3 Posters 608 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    frittata_studio
    wrote on last edited by arminunruh
    #1

    Hello,

    I would like to ask if there is a way to space the elements inside the navbar equally, so that the menu items take up the full width of the page.

    Currently, we only have pixels to space the elements, so I have been trying to use custom CSS, but have not been successful.

    If anyone knows how to achieve this, it would be fantastic!

    Thank you.

    1 Reply Last reply
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      sure!

      nav.primary{
      /* 60px here is space left * 2 so the nav doesn't go to the full width of the page */
      width: calc(100% - 60px);
      display: flex;
      }
      
      nav.primary ul{
      display: flex;
      justify-content: space-between;
      }
      

      in "desktop css"

      F 1 Reply Last reply
      0
      • arminunruhA arminunruh

        sure!

        nav.primary{
        /* 60px here is space left * 2 so the nav doesn't go to the full width of the page */
        width: calc(100% - 60px);
        display: flex;
        }
        
        nav.primary ul{
        display: flex;
        justify-content: space-between;
        }
        

        in "desktop css"

        F Offline
        F Offline
        frittata_studio
        wrote on last edited by
        #3

        Hi @arminunruh

        thank you for that, I tried it and it does not seem to work, I show what I got: Screenshot 2023-04-07 at 11.59.25.png

        1 Reply Last reply
        0
        • F Offline
          F Offline
          frittata_studio
          wrote on last edited by
          #4

          @arminunruh not sure if this is correct, but doing the code in this way it does the job:

          nav.primary{
          width: 100%;
          display: flex;
          }
          
          nav.primary li{
          width: 32vw;
          display: flex;
          justify-content: space-between;
          }
          

          What do you think?

          1 Reply Last reply
          0
          • arminunruhA Offline
            arminunruhA Offline
            arminunruh
            Global Moderator
            wrote on last edited by
            #5

            oh yea you can do it like that too

            mh

            F 2 Replies Last reply
            0
            • arminunruhA arminunruh

              oh yea you can do it like that too

              mh

              F Offline
              F Offline
              frittata_studio
              wrote on last edited by
              #6

              @arminunruh Fantastic, thank you so much for your help

              1 Reply Last reply
              0
              • arminunruhA arminunruh

                oh yea you can do it like that too

                mh

                F Offline
                F Offline
                frittata_studio
                wrote on last edited by frittata_studio
                #7

                @arminunruh sorry Armin, quick question

                I edited the code in this way in the end:

                nav.primary{
                    width: 95%;
                    display: -webkit-flex;
                    display: flex;
                    -webkit-justify-content: space-between;
                    justify-content: space-between;
                }
                
                
                nav.primary li{
                    display: block;
                    padding-right: 9vw;
                    padding-left: 9vw;
                }
                

                But there is still something strange in that, basically, I would like to have the first text aligned to the margin left and the last voice in the menu should be aligned at the margin right.

                If you look the navbar at this moment, they are all evenly spaced but they are all centered.

                Screenshot 2023-04-19 at 11.12.29.png
                Screenshot 2023-04-19 at 11.12.03.png

                There is a way to update it?

                Thanks!

                panteleyP 1 Reply Last reply
                0
                • F Offline
                  F Offline
                  frittata_studio
                  wrote on last edited by
                  #8

                  Fixed!

                  In case someone needs it:

                  nav.primary{
                      width: 97.5vw;
                      display: -webkit-flex;
                      display: flex;
                      -webkit-justify-content: space-between;
                      justify-content: space-between;
                      flex-wrap: wrap
                  }
                  
                  nav.primary ul{
                      display: flex;
                      justify-content: space-between;
                      flex: 1;
                  }
                  
                  1 Reply Last reply
                  2
                  • arminunruhA Offline
                    arminunruhA Offline
                    arminunruh
                    Global Moderator
                    wrote on last edited by
                    #9

                    nice! very good

                    1 Reply Last reply
                    0
                    • F frittata_studio

                      @arminunruh sorry Armin, quick question

                      I edited the code in this way in the end:

                      nav.primary{
                          width: 95%;
                          display: -webkit-flex;
                          display: flex;
                          -webkit-justify-content: space-between;
                          justify-content: space-between;
                      }
                      
                      
                      nav.primary li{
                          display: block;
                          padding-right: 9vw;
                          padding-left: 9vw;
                      }
                      

                      But there is still something strange in that, basically, I would like to have the first text aligned to the margin left and the last voice in the menu should be aligned at the margin right.

                      If you look the navbar at this moment, they are all evenly spaced but they are all centered.

                      Screenshot 2023-04-19 at 11.12.29.png
                      Screenshot 2023-04-19 at 11.12.03.png

                      There is a way to update it?

                      Thanks!

                      panteleyP Offline
                      panteleyP Offline
                      panteley
                      wrote on last edited by panteley
                      #10

                      @frittata_studio @arminunruh Hey, is it possible to add a certain spacing from the edges of the screen, left and right, in % or px? So they stick whithin website's frame spacing when you resize the browser šŸ¤”

                      111.png 222.png

                      1 Reply Last reply
                      0
                      • arminunruhA Offline
                        arminunruhA Offline
                        arminunruh
                        Global Moderator
                        wrote on last edited by
                        #11

                        @frittata_studio said in full width space in navbar / menu and evenly distribute menu items to fill out whole navbar:

                        nav.primary{
                        width: 97.5vw;

                        the width: 97.5vw determines the width of the nav

                        just do

                        nav.primary{
                            width: 100%;
                            display: -webkit-flex;
                            display: flex;
                            -webkit-justify-content: space-between;
                            justify-content: space-between;
                            flex-wrap: wrap
                            padding-left: 0.5%;
                            padding-right: 0.5%;
                            box-sizing: border-box;
                        }
                        
                        nav.primary ul{
                            display: flex;
                            justify-content: space-between;
                            flex: 1;
                        }
                        

                        here im using 0.5% for padding-left and -right, because that is your frame-left and frame-right value

                        panteleyP 2 Replies Last reply
                        0
                        • arminunruhA arminunruh

                          @frittata_studio said in full width space in navbar / menu and evenly distribute menu items to fill out whole navbar:

                          nav.primary{
                          width: 97.5vw;

                          the width: 97.5vw determines the width of the nav

                          just do

                          nav.primary{
                              width: 100%;
                              display: -webkit-flex;
                              display: flex;
                              -webkit-justify-content: space-between;
                              justify-content: space-between;
                              flex-wrap: wrap
                              padding-left: 0.5%;
                              padding-right: 0.5%;
                              box-sizing: border-box;
                          }
                          
                          nav.primary ul{
                              display: flex;
                              justify-content: space-between;
                              flex: 1;
                          }
                          

                          here im using 0.5% for padding-left and -right, because that is your frame-left and frame-right value

                          panteleyP Offline
                          panteleyP Offline
                          panteley
                          wrote on last edited by
                          #12
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • arminunruhA arminunruh

                            @frittata_studio said in full width space in navbar / menu and evenly distribute menu items to fill out whole navbar:

                            nav.primary{
                            width: 97.5vw;

                            the width: 97.5vw determines the width of the nav

                            just do

                            nav.primary{
                                width: 100%;
                                display: -webkit-flex;
                                display: flex;
                                -webkit-justify-content: space-between;
                                justify-content: space-between;
                                flex-wrap: wrap
                                padding-left: 0.5%;
                                padding-right: 0.5%;
                                box-sizing: border-box;
                            }
                            
                            nav.primary ul{
                                display: flex;
                                justify-content: space-between;
                                flex: 1;
                            }
                            

                            here im using 0.5% for padding-left and -right, because that is your frame-left and frame-right value

                            panteleyP Offline
                            panteleyP Offline
                            panteley
                            wrote on last edited by
                            #13

                            alt text

                            1 Reply Last reply
                            1
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            I also code custom websites or custom Lay features.
                            šŸ’æ Email me here: šŸ’æ
                            info@laytheme.com

                            Before you post:
                            1. When using a WordPress Cache plugin, disable it or clear your cache.
                            2. Update Lay Theme and all Lay Theme Addons
                            3. Disable all Plugins
                            4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                            This often solves issues you might run into

                            When you post:
                            1. Post a link to where the problem is
                            2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                            3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                            Online Users
                            A
                            alasdair17
                            Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                            laytheme.com
                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Search