• Resolved lili23

    (@lili23)


    Hello,

    I’m sorry for asking this question which already had been discussed in this forum. But I’ve tried all the proposed solutions and they didn’t work with me.
    Is the following code wrong?

    .menu-secondary li a {
    background-color: #0000ff;
    }

    (Changing #0000ff to the desired color)

    Thank you for your help!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hy lili23,

    The above code is not wrong… depending on where you apply it.

    Can you provide me with the link to the theme so i can help you adding the correct css code.

    Kind regards,

    Larsen

    Thread Starter lili23

    (@lili23)

    Hello Larsen,

    the site is https://lydiamariabader.com/

    I put it in the css stylesheet editor.

    Hy lilli,

    here you go:

    #menu-secondary,#menu-secondary-items li{
    background-color:#0000ff;
    }

    You didn’t targeted the div correctly.

    When you target a div with an ID like <div id=”menu-secondary”
    you need to use #menu-secondary in your css.

    when you target a class like <div class=”menu-secondary”
    you can use .menu-secondary

    Hope it helps!

    Kind regards,

    Larsen

    Thread Starter lili23

    (@lili23)

    Thank you so much!

    I’m not sure I completly understand why but it’s working now.

    Have a good night,
    Lili

    Hy lili,

    When creating a div you can add 2 different references for using in the css file.

    one called ID and one called class:

    <div id=”theid” class=”theclass”>

    when you want to target a id the prefix is a hashtag ( #) but when you target a class the prefix is a dot (.)

    the name you have used ( menu-secondary li a) was the name of the ID of the div but because you where using a dot the css didn’t find a match.

    the reason why i have added #menu-secondary AND #menu-secondary-items li is because the menu-secondary was just the outside wrapper with a black background, the secondary items also had a black background.

    For more information on ID’s and classes read:
    https://css-tricks.com/the-difference-between-id-and-class/

    Kind regards,

    Larsen

    Thread Starter lili23

    (@lili23)

    Thanks Larsen, that’s great to know for the future.
    One last question:
    Do you happen to know why there’s only part of the secondary menu becoming black when hovering over it, and if there’s a not too complicated way to fix it? I hope you know what I mean…

    Greetings
    Lili

    Hy lili23,

    This should work, can you test this for me?

    #main .aside #menu-secondary ul li a{
    min-width:100%;
    margin:0px -9em 0px -2em;
    }
    Thread Starter lili23

    (@lili23)

    Yes, looking perfect now, thank you! :-))

    No problem, if i come up with a better solution i will post it here.

    Meanwhile.. goodluck with this quickfix!

    Kind regards,

    Larsen

    many thanks for the support, exactly what i was looking for too

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Change color of secondary menu’ is closed to new replies.