FRONTEND_1 Telegram 4042
Мини-хак: :has() в CSS — меньше JS для интерактивности 🎯

Современные браузеры уже поддерживают :has()“родительский селектор”, который раньше приходилось эмулировать на JS.

Пример: показать рамку у карточки, если внутри есть картинка:


.card:has(img) {
border: 2px solid #4ade80;
}


Ещё круче: стилизовать соседний элемент, если внутри инпута что-то введено:


.input-wrapper:has(input:focus) label {
color: #3b82f6;
}


Зачем это нужно?
— Меньше JS → проще поддержка
— Новый уровень гибкости для UI

Документация: MDN про :has()

Пробуйте! Это реально меняет подход к верстке.

👉 @frontend_1
👍3



tgoop.com/frontend_1/4042
Create:
Last Update:

Мини-хак: :has() в CSS — меньше JS для интерактивности 🎯

Современные браузеры уже поддерживают :has()“родительский селектор”, который раньше приходилось эмулировать на JS.

Пример: показать рамку у карточки, если внутри есть картинка:


.card:has(img) {
border: 2px solid #4ade80;
}


Ещё круче: стилизовать соседний элемент, если внутри инпута что-то введено:


.input-wrapper:has(input:focus) label {
color: #3b82f6;
}


Зачем это нужно?
— Меньше JS → проще поддержка
— Новый уровень гибкости для UI

Документация: MDN про :has()

Пробуйте! Это реально меняет подход к верстке.

👉 @frontend_1

BY Frontend разработчик




Share with your friend now:
tgoop.com/frontend_1/4042

View MORE
Open in Telegram


Telegram News

Date: |

The public channel had more than 109,000 subscribers, Judge Hui said. Ng had the power to remove or amend the messages in the channel, but he “allowed them to exist.” The visual aspect of channels is very critical. In fact, design is the first thing that a potential subscriber pays attention to, even though unconsciously. A new window will come up. Enter your channel name and bio. (See the character limits above.) Click “Create.” Your posting frequency depends on the topic of your channel. If you have a news channel, it’s OK to publish new content every day (or even every hour). For other industries, stick with 2-3 large posts a week. According to media reports, the privacy watchdog was considering “blacklisting” some online platforms that have repeatedly posted doxxing information, with sources saying most messages were shared on Telegram.
from us


Telegram Frontend разработчик
FROM American