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.
2 answers
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; /* Цвет активной ссылки */ } - 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
|
