WordPress.org

Ready to get started?Download WordPress

Forums

Giving width to nav buttons in fixed width menu (12 posts)

  1. gutterboy333
    Member
    Posted 1 year ago #

    I am building a site into WP that has a fixed width menu and having a lot of issues with getting the sizing of it to play nice with WP.

    Is the best way to handle this to apply some custom CSS for the specific menu ID that WP has automatically assigned to each button? Can these ID's be trusted? Like, do they ever change?

    Is there a better way to handle a fixed with menu?

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you give an example of these IDs WordPress supplies?

  3. gutterboy333
    Member
    Posted 1 year ago #

    menu-item-801
    menu-item-802
    menu-item-805

    etc..

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    They are reliable unless the page is deleted.

  5. cinghaman
    Member
    Posted 1 year ago #

    custom css would still be a better option u could do something like

    #menu_id > ul li
    and if you know to use

    first-child::
    last-child::
    elements

  6. gutterboy333
    Member
    Posted 1 year ago #

    Thanks Andrew.

    Robin..... that would cause issues if the buttons were moved around.

  7. cinghaman
    Member
    Posted 1 year ago #

    buttons were moved around ?

  8. gutterboy333
    Member
    Posted 1 year ago #

    Yes, if the buttons are moved from for example the first spot (first child) to the 3rd child.

  9. cinghaman
    Member
    Posted 1 year ago #

    ah
    the first child means if u have menu like
    a
    b
    c

    no matter where u move there always be a first child and always be a last child no matter where you move

    a is first child
    and c is last child
    yup unless you only have 1 menu item

  10. cinghaman
    Member
    Posted 1 year ago #

    and if you even added 10 menu items the 10th item would automatically be considered last child

  11. gutterboy333
    Member
    Posted 1 year ago #

    Yeah I know that, but what I mean is if you set the width of say the first-child (Example 1) to 100px and the 3rd child (Example 2) to 150px and then moved Example 1 to be the third child and Example 1 to be the first child, then that would mean Example 2 now would have a width of 100px and Example 1 would have a width of 150px. ;)

  12. cinghaman
    Member
    Posted 1 year ago #

    so you have
    home
    about
    contact
    so you would want to move them to
    contact
    about
    home

    any how not sure how your menu are structured i just said in ideal conditions using li and first child last child is a better option

Topic Closed

This topic has been closed to new replies.

About this Topic