0

I am trying to change background of second span when I am on first span. I mean when are you on that my row, then menu-settings-img changes background and menu-settings-title changes color of text. I tried doing it in css but I do not know really how to achieve this. Can you help me? My code:

<div class="row" style="margin-top: 10px;">
    <div style="margin-left: 50px;">
        <a href="" id="link-settings" href="">
        <div width="80%;">
          <span class="menu-settings-img">
            <img style="width: 4%;" src="{{(career.png) }}">
          </span>
          <span class="menu-settings-title">@lang('main.career')</span>
        </div>
        </a>
    </div>
</div>
Promgrma
  • 29
  • 1
  • 5

1 Answers1

0

You can make it using css with the + selector this way :

<style type="text/css">
.menu-settings-img:hover + span {
    background-color: #F0F;
}
</style>

<div class="row" style="margin-top: 10px;">
    <div style="margin-left: 50px;">
        <a href="" id="link-settings" href="">
        <div width="80%;">
          <span class="menu-settings-img">
            <img style="width: 4%;" src="http://placehold.it/300x300.jpg">
          </span>
          <span class="menu-settings-title">titre</span>
        </div>
        </a>
    </div>
</div>

The + selector points to the next cibling element. see this doc for more informations.

kevinniel
  • 1,088
  • 1
  • 6
  • 14