ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   Задачи по верстке (https://forum.antichat.xyz/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


Время: 02:24