I made a slider. How to make it so that when you click, for example, the word "Web design", it becomes a different color. It is not when you hover, but after clicking.

enter image description here

  • You can with the help of js - goodalien
  • one
    @ goodalien1125, why? Why poke js everywhere? - HamSter
  • @ElenaSemenchenko, it seems to me easier to implement using it .. - goodalien
  • Add an example markup of your slider - Grundy

2 answers 2

If without the help of js, then on css this is done using the hidden checkbox wrapped in a label

Accordingly, in the css for the checked state, change the style

UPD

html

<input id="tabl1" type="radio" name="tabs" checked=""> <label for="tabl1">your html</label> 

css

 .tabs > label:hover { some-style } .tabs > input:checked + label { other-style } 
      a:link { color: #0000d0; /* Цвет ссылок */ } a:visited { color: #900060; /* Цвет посещенных ссылок */ } a:active { color: #f00; /* Цвет активной ссылки */ } 

    doc

    • I mean a specific point in time. That is, when you click on "Web design", it would become red, and when you click on another element, "Web design" would again become white. And so for each element - user226023 Nov.
    • Heh, did not help the hacks with css :) - Telion
    • @Levelleor, what hacks ?! - HamSter
    • @Elena Semenchenko, well, you so ominously insisted that js do not need to implicate that it is even ridiculous. - Telion
    • @Levelleor, it's funny not to know the basics of css and insert js where it is not needed !!! Clogging up the page! - HamSter