Kevin Powell - Community

KPC

Kevin Powell - Community

A friendly place for developers to meet other devs, ask questions, get help, and just have a good time 🙂.

Join

front-end

resources

back-end

ui-ux

os-and-tools

help

React passing props to children within parent component + TypeScript

Let's say I have Select component that manages state for event onChangeOption when option is checked/unchecked. Option can be component SimpleOption or CheckboxOption. Select.tsx ```js interface Props {...

background svg

i would like to know how i can do this backgroud for my project
No description

Burger menu JavaScript not working

Hi! I am trying to use a JavaScript function to toggle on and off my burger menu list, but for some reason is not working. I attached a video so you can see what's going on. You can also take a look at my code here: https://codepen.io/Abdiel-Peguero/pen/MWLPjej
Thanks in advance!!...

Can name be an h1?

Semantic question re html h1-h6 tags. I have a bunch of users and present their data/ statistics on separate pages which start with a user name. Is it correct to use user name as a title of such page? Like this: "<h1>username</h1>" #html #semantic

GSAP scrollTrigger always snaping to first element in React

Im looking for someone that has some experience with GSAP animation. Im working on my personal project, however i am encountering this problem with GSAP scrollTrigger and scrollSmoother. Problem is that my React app is always snaping to first element on the page , and im trying to achieve the whole page 'slider' effect where he can scroll through the slides but in very smooth way. I achieved all that except this last part where I want to make the scrolling smooth HTML is only 5 sections My react logic:...

Select a pseudo-element's "owner" (css nesting)

Hey! I just wanted to know, when nested in some pseudo-elements rule, is it possible to access its "owner" (select #owner:hover::after when in #owner::after, for instance)? That's more a question about CSS than a problem, I'm just curious.

help ç-ç

Tips for positioning these 12 elements?
No description

is it possible to get the values from browser console and display the result in browser UI?

Let say i created a 3 different function , when user enters
myFunc(5)
myFunc(5)
in browser console, the output of it should be displayed in the UI. Is it possible?

How to reproduce Apple’s clock text effect

This may not be possible, but I’d love to be able to reproduce this effect Apple uses on their clocks in their various OS’s. I think it’s a backdrop-filter of sorts but is clipped by the text with some sort of blend mode applied. Is this even possible with CSS?
No description

How i do thisss

Hi guys, I want to replicate this layout, any tips for positioning the beer and leaves? There is also this banner that is divided which I am unsure about.
No description

Canvas in flexbox not resizing properly

Any idea why the canvas in this example code takes the full width of the viewport? https://codepen.io/codecab/pen/abXaKJr?editors=1100 When I replace the canvas with a div it works as expected. I put the canvas in a wrapper element for now, which works, but I'd like to understand why its behaving as it does. Am I missing something?...

EM and REM scaling in different resolutions

Hello, i have a question about EM and REM and i don't found any answer, even chatgpt doesn't know. I understand how they work. For example 16px font size on the root, 2REM = 32px and EM the font-size of the parent element. What i don't understand is how they scale in different screen resolutions. Because if i set the font-size for example 16px and i use rems on my page. The page will look good on 1080p but on a 4k monitor would look tiny, because when i use REM in the end is still pixels. (and pixel is a fixed value) If i don't declare the font-size what will the browser consider as default font-size? I mean is something fixed to 16px? Or it varies on the screen resolution? Example if i am in 1080p will be 16px, 1440p 32px, 4k 64px? ...

Place a circle behind a DIV (CSS)

Hi. I have no problem creating the modal. My issue is how to get the circle behind it, and center both of them in the middle of the browser. I have included a screenshot of what I am trying replicate. Thanks for your help....
No description

Navbar doesn t work in mobile

I'd like to know why my navbar when I put it a position fixed the dropdown mobile does not work, can someone help me? Link: https://656676d9227bb411d9612f93--zippy-crepe-af5c29.netlify.app/...
No description

Infinite Scroll...

I LOVE Kevin's Infinite Scroll but how do I force it to show only 3 images at a time or two, etc? https://codepen.io/kevinpowell/pen/BavVLra

Problem with the form - the message can be moved sideways after expanding

Hi all. As in the title, if someone wanted to enlarge the message, I would like it to be possible to scroll down instead of sideways. In short, there is a button to enlarge the message, I want it to only be possible to scroll down. It's my first time making a form and I can't quite get it done. mypen: https://codepen.io/Bartomiej-/pen/MWLBpjO...
No description

Short question: How does CSS zoom work?

I need to figure out the new width & height of an element. And as getBoundingClientRect() doesn't compute the zoom (or well - it does, in a very buggy way: 1000px width with 50% zoom results in 999.34565px or so...) so I need to calc it by hand. So does zoom take the diagonal of an element and I need to go with Pythagoras (never expected to really use it in my life :D) to get the new width and height? Because this:...

Bottom Navbar

Hi, everyone. I am trying to make bottom navigation bar, but when i scroll page to the bottom - it overlaps on text/components. How can i make it visible all the time, but to not overlap on other items at the bottom of the page? stackblitz: https://stackblitz.com/edit/stackblitz-starters-bm1fj6?file=app%2Fpage.tsx...
No description

Need advice on making CSS Grid containers equal in height/width with responsive design - any tips?

I'm facing a challenge with CSS Grid Layout in creating a responsive design where grid containers need to have equal height and width. These containers hold varying amounts of content. While I've tried using min-height, it compromises the fluid responsiveness of the layout. I'm looking for a solution that maintains equal dimensions across these containers without losing the responsiveness. Has anyone tackled a similar issue or have suggestions on how to achieve this effectively? Any insights or alternative approaches would be greatly appreciated! Please go easy on me. I'm only doing this to learn about Grid and am overwhelmed by Clamp, Minmax, etc. 🙂...
No description

I can't see my images

I am trying to make a slider carousel, but for some random reason that I don't know, I can't see my images on the screen.... I just can see the dots from the sliderSettings In the SlideImage style component only has a width for the img ```js import React, { useEffect, useRef, useState } from "react"; import { ProvaSocialContainer, TextContainer, SlideImage } from "../styles/ProvaSocial.style";...
No description