Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • 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. bar to separate menu elements

bar to separate menu elements

Scheduled Pinned Locked Moved General Discussion
9 Posts 3 Posters 34 Views 2 Watching
  • 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.
  • E Offline
    E Offline
    emmapasteur
    wrote last edited by
    #1

    Hi ! Do you have an idea how I could add vertical bars to separate the elements of my menu as shown on the image ?
    I tried to add it before the words but as every element is independant the bar is never centered...

    Thank you vm

    Capture d’écran 2026-05-22 à 11.05.20.png

    1 Reply Last reply
    0
    • emgeofficeE Offline
      emgeofficeE Offline
      emgeoffice
      wrote last edited by
      #2

      Have you added it via css?

      1 Reply Last reply
      0
      • E Offline
        E Offline
        emmapasteur
        wrote last edited by
        #3

        I tried yes... but as i said i can't manage to center it between the words

        1 Reply Last reply
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote last edited by arminunruh
          #4
          <script>
          (function () {
          	var lists = document.querySelectorAll('nav.laynav.primary > ul');
          	for (var i = 0; i < lists.length; i++) {
          		var ul = lists[i];
          		// collect the real menu items (excluding dividers)
          		var items = [];
          		for (var c = 0; c < ul.children.length; c++) {
          			var child = ul.children[c];
          			if (child.tagName === 'LI' && !child.classList.contains('lay-menu-divider')) {
          				items.push(child);
          			}
          		}
          		// insert a divider before every menu item except the first
          		for (var j = 1; j < items.length; j++) {
          			var prev = items[j].previousElementSibling;
          			if (prev && prev.classList.contains('lay-menu-divider')) {
          				continue; // divider already there
          			}
          			var divider = document.createElement('li');
          			divider.className = 'lay-menu-divider';
          			divider.setAttribute('aria-hidden', 'true');
          			ul.insertBefore(divider, items[j]);
          		}
          	}
          })();
          </script>
          
          <style>
          /* Vertical divider line between menu items (JS-inserted <li>) */
          nav.laynav.primary > ul > li.lay-menu-divider {
          	display: inline-block;
          	vertical-align: middle;   /* vertically centered on the menu line */
          	width: 1px;               /* line thickness */
          	height: 15px;             /* line height */
          	margin: 0 2px;           /* space left/right → breathing room from the text */
          	padding: 0;
          margin-top: 5px;
          	background-color: #000;   /* black */
          }
          </style>
          

          copy this and put it into "html at bottom"

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

            then you can adapt the CSS so the line has the right height and spacing.

            grafik.png

            Try to adapt the CSS using maybe ChatGPT or Gemini or something if you need help with that

            1 Reply Last reply
            0
            • E Offline
              E Offline
              emmapasteur
              wrote last edited by
              #6

              I can't find the "html at bottom" window you are talking about... thank you very much for your help

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

                I changed the code a little bit. I had one or two things that were not optimal yet. You can copy the code again from my post above.

                You will find it in Lay Options . Custom HTML and CSS, and I think it's the very last text box at the bottom.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  emmapasteur
                  wrote last edited by
                  #8

                  Thank you so much.

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

                    you're welcome! <3

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


                    For paid 1-on-1 Lay Theme Coaching, contact Audrey (audrey@cyberslayers.work) or me (info@laytheme.com).

                    We also code custom websites or bespoke Lay features. Drop me a line at info@laytheme.com or check out my work at arminunruh.com.

                    Want to support my work? paypal.me/arminunruh

                    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
                    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