Sign in

css class syntax for sub-menu in Publii ?

  • This topic has 4 replies, 2 voices, and was last updated 3 weeks, 3 days ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8155
    Avatar photomuch.fun

    Dear all –

    I am looking for the correct syntax for the css class for a sub menu…

    Assuming the calls is defined as  .sub-menu  { margin-left: 25px; }

    what do I have to put in “edit menu item” dialogue: .sub-menu  or sub-menu or “sub-menu” ?

    I have not found any hint in the Docs for Users nor in the Docs for Developers ….

    Thanks in advance, Michael

    #8157
    Avatar photoBob

    Hi Michael,

    I’m not sure if I understand you well, but there is no need to add any class while editing menu items.
    Menu classes are added automatically depending on how the theme developer implemented them.

    More about the CSS classes generated by Publii menus: https://getpublii.com/dev/default-publii-classes-for-using-with-css/#menu

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #8159
    Avatar photomuch.fun

    Hi, Bob,

    thanks for the quick reply. In other words:

    I built a website using WordPress, and the menu looks like this:

    Bild-01.09.22-um-18.06

    the CSS:

    Bild-01.09.22-um-18.16

    Now want to rebuild this site using Publii, but the menu indent does not work:

    Bild-01.09.22-um-18.13

    Therefore I want add a class in the macOS App (v0.40.2) under Menus > Add menu item > Edit menu item > CSS class

    Bild-01.09.22-um-18.07

    So the question is, what do I have to put in “CSS class” exactly ?

    Best Regards, Michael

    #8165
    Avatar photoBob

    Add a CSS class without the dot.

    If you use the CSS rules from the previous theme (WP), I recommend modifying the menu.hbs file ‎⁨(Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME ▸ partials) and replacing the current menu CSS classes with those of the WP CSS.

    For example, replace the navbar__submenu with sub-menu

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #8166
    Avatar photomuch.fun

    ok, as I use the WP classes, I will follow your advise and rewrite the menu.hbs.

    Thanks for your help,

    Cheers, Michael

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘css class syntax for sub-menu in Publii ?’ is closed to new replies.