V
V
Vladimir Yurchenkov2016-10-09 16:29:45
css
Vladimir Yurchenkov, 2016-10-09 16:29:45

How to change the color of links in the menu?

How to change the color of links in the menu when a certain selector is opened?

There is a site with a fixed left menu with links

<div class="menu">
      <ul>
      <li class="item"><a href="#1">Продажа недвижимости</a></li>
      <li class="item"><a href="#2">Строительство</a></li>
      <li class="item"><a href="#3">Производство</a></li>
      <li class="item"><a href="#4">Проектирование</a></li>
      <li class="item"><a href="#5">Услуги</a></li>
      </ul>
    </div>


And of course there are 5 selectors, each with elements of a certain color.

1-pink
2-blue
3-red
4-green
5-orange

For example, we are on selector 1 (the colors are pink). I need the links in the menu (hover color and active link) to change color when moving to the next one, i.e. 2 (blue). How to do this and is it possible without scripts?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dark Hole, 2016-10-09
@EPIDEMIASH

.item > a[href=#1]:hover {
  color: red;
}

D
Denis T, 2016-10-10
@tyukavin_denis

codepen.io/slow_D/pen/vXRWbw

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question