A
A
Andrey Dobrin2018-03-27 21:15:57
css
Andrey Dobrin, 2018-03-27 21:15:57

When you clicked on the link, it was active in a new window. How to do it?

I have three links:
Menu
Home
Advertisement

Their initial styles are:

a{
color: black;
text-decoration: none;
text-transform: uppercase;
}

I want that when you click on them, the window corresponding to the link opens, but so that it already looks like it is active there, as if it has the following styles:
a{
color: red;
text-decoration: none;
text-transform: uppercase;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2018-03-27
@andreydobrin

You create any class, you give it to the necessary reference, in each window.

a.active {
color: red;
text-decoration: none;
text-transform: uppercase;
}

for the first page:
<a href='1.html' class="active">Первая</a>
<a href='2.html' class="">Вторая</a>
<a href='3.html' class="">Третья</a>

For the second
<a href='1.html' class="">Первая</a>
<a href='2.html' class="active">Вторая</a>
<a href='3.html' class="">Третья</a>

etc.
You can try using js, so that it is selected from somewhere (attribute, title) and checked with the name of the link and assigns it the desired class (design), but something tells me that handles, through CSS, will be easier.

V
Valery Gutin, 2018-03-27
@alohamneploha

htmlbook.ru/css/active

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question