Web design source code – Telegram
Web design source code
866 subscribers
224 photos
71 videos
82 files
44 links
Advertisements Contact me👇🏻
@We_D5
design web
source code free
https://news.1rj.ru/str/Web_design3
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
⭐️CSS Tip!⭐️

To create an inverted :hover effect, you can use mix-blend-mode with custom :hover properties.

button > span {
left: calc(var(--x, 0) * 1px);
top: calc(var(--y, 0) * 1px);
mix-blend-mode: difference;
}



The cool thing is that using mix-blend-mode acts as a color inverter, which works well with monochrome controls.

As for how to move this code to JavaScript?


const UPDATE = ({target, x, y }) => {
const bounds = target.getBoundingClientRect()
target .style.setProperty('--x', x - bounds.left)
target .style.setProperty('--y', y - bounds .top)
}

const BTNS = document.querySelectorAll('button')
BTNS.forEach(BTN => BTN.addEventListener('pointermove', UPDATE))




button:is(:hover, :focus-visible) {
--active: 1;
}
button span {
transform: translate(-50%, -50%) scale(calc(var(--active, 0) * 3);
transition: transform 0.25s;
}
1
💡 You can use new CSS features and apply fallback styles in unsupported browsers using the supports rule. The same can be done in JavaScript.
1
This media is not supported in your browser
VIEW IN TELEGRAM
💡 How to Easily Create an Accordion Without JavaScript: A Note for Front-End Developers
1
🖥 pop() method:

🌟 This method removes the last element of an array and returns the removed element.
1
🔰 CSS for JavaScript Developers
1