ANTICHAT

ANTICHAT (https://forum.antichat.io/index.php)
-   Общие вопросы программирования (https://forum.antichat.io/forumdisplay.php?f=206)
-   -   Задачи по верстке (https://forum.antichat.io/showthread.php?t=789866)

L2Banners 03.02.2024 21:15

Если кому-то будет интересно, в этой теме буду публиковать задачи по верстке, которые помогут попрактиковаться или просто оценить свои знания.

Задача №1:

Заливайте свой код в песочницу, к примеру https://codepen.io

Steve Dogs 03.02.2024 23:08

Я просто привык @L2Banners деньги на карту отправлять за решение таких задач.

Задача решена? https://codepen.io/istevedogs/pen/JjzvZaw

L2Banners 03.02.2024 23:16

Цитата:

Сообщение от Steve Dogs

Задача решена? https://codepen.io/istevedogs/pen/JjzvZaw

Внимательно прочитай условие)

Должно быть наоборот, кнопка на которую наводишь остается, а другие исчезают

Steve Dogs 03.02.2024 23:43

Цитата:

Сообщение от L2Banners

Внимательно прочитай условие)
Должно быть наоборот, кнопка на которую наводишь остается, а другие исчезают

Вот так? - https://codepen.io/istevedogs/pen/JjzvZaw

L2Banners 04.02.2024 00:12

Цитата:

Сообщение от Steve Dogs

Хотел похвалить, но нет

В твоем варианте, если курсор попадает в контейнер, например между кнопками, то все кнопки исчезают, а в моем примере я свободно вожу курсором по контейнеру и между кнопками специально, чтобы показать этот момент, так что пока не решено

un1k 04.02.2024 00:33

I want to participate but is hard to understand russian))

The css to do this would be the use of :has and ~

:has To select the previous siblings:

Цитата:


span:has(~ span:ishover)) {
opacity: 0;
}

~ To select the next siblings:

Цитата:


span:hover ~ span {
opacity: 0;
}

https://codepen.io/ofuwdwfe-the-animator/pen/wvOjxrP

Steve Dogs 04.02.2024 00:40

Цитата:

Сообщение от un1k

I want to participate but is hard to understand russian))

The css to do this would be the use of :has and ~

:has To select the previous siblings:

~ To select the next siblings:

https://codepen.io/ofuwdwfe-the-animator/pen/wvOjxrP

Amazing

L2Banners 04.02.2024 00:52

Цитата:

Сообщение от un1k

I want to participate but is hard to understand russian))

Task:

There are 2 buttons, when we hover the cursor over one of them, the second disappears.

The task needs to be solved only using HTML and CSS

without using javascript

Цитата:

Сообщение от un1k

Yes, this is a good solution.

Try to solve this without using the pseudo-classes :is() and :has()

You can solve this using only one pseudo-class :hover. Then it will be more cross-browser

un1k 04.02.2024 01:04

Цитата:

Сообщение от L2Banners

Task:
There are 2 buttons, when we hover the cursor over one of them, the second disappears.
The task needs to be solved only using HTML and CSS
without using javascript

Yes, this is a good solution.

Try to solve this without using the pseudo-classes :is() and :has()
You can solve this using only one pseudo-class :hover. Then it will be more cross-browser

Oh, :has is supported by all major browsers, but this can also be made with * but I don't know if I would use it instead of :has

Цитата:


*, button:hover {
opacity: 0;
}


un1k 04.02.2024 01:12

Forgot the codepen, sorry

https://codepen.io/ofuwdwfe-the-animator/pen/wvOjxrP

L2Banners 04.02.2024 01:18

Цитата:

Сообщение от un1k

It doesn't work

Цитата:

Сообщение от un1k

Oh, :has is supported by all major browsers

90%. That's quite enough, I don't argue

Your decision is good, I agree with that.

This is a task for practice and has more than one solution.

un1k 04.02.2024 01:27

Цитата:

Сообщение от L2Banners

It doesn't work

I just saw now how wrong it is lol

I remember reading an article about * when you recommended me not to use it, it should be possible to do something like this, I don't remember how

L2Banners 04.02.2024 01:36

Цитата:

Сообщение от un1k

I just saw now how wrong it is lol

I remember reading an article about * when you recommended me not to use it, it should be possible to do something like this, I don't remember how

I do not give unnecessary information so as not to limit the possible number of solutions. This will allow us to find a lot more solutions than I know.

un1k 04.02.2024 01:50

Цитата:

Сообщение от L2Banners

I do not give unnecessary information so as not to limit the possible number of solutions. This will allow us to find a lot more solutions than I know.

I made a work around on @Steve Dogs solution

I just set pointer-event: none; for the parent and 'all' for the childs, this way the parent will only trigger :hover when the button is selected.

https://codepen.io/ofuwdwfe-the-animator/pen/wvOjxrP

V11 04.02.2024 02:13

делаешь в over огромную кнопку с бг фона) при наведении все будет пропадать)

L2Banners 04.02.2024 02:16

Цитата:

Сообщение от un1k

This is a good and simple solution!

un1k 04.02.2024 02:16

Цитата:

Сообщение от V11

делаешь в over огромную кнопку с бг фона) при наведении все будет пропадать)

It won't, as I explained, the :hover of the parent will be trigged only when the button is selected, you can play around on codepen and set a normal width to the button.

https://codepen.io/ofuwdwfe-the-animator/pen/wvOjxrP

L2Banners 04.02.2024 02:17

Цитата:

Сообщение от V11

делаешь в over огромную кнопку с бг фона) при наведении все будет пропадать)

Кидай в codepen посмотрим

L2Banners 09.02.2024 21:15

Варианты решения задачи №1:

https://codepen.io/pershinvitalii/pen/rNRrXLb

https://codepen.io/pershinvitalii/pen/JjzBgvX

https://codepen.io/pershinvitalii/pen/gOEjVzo

https://codepen.io/pershinvitalii/pen/gOEdYbj

https://codepen.io/pershinvitalii/pen/MWxqJMX

https://codepen.io/pershinvitalii/pen/ZEPMaxr

https://codepen.io/pershinvitalii/pen/MWxqOqQ

L2Banners 22.02.2024 08:39

Еще одна задача:

L2Banners 28.02.2024 11:33

Вторая задача не зашла)

Ловите хак по анимированному подчеркиванию ссылок:


Время: 21:38