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

[React] How does this code look to you?

Friend and I spent a few hours yesterday trying to get setInterval and useEffect to work on our little workout app. Brains were fried, and it works, but we're curious on your opinions on how we 've done it. Can't copy paste the code, but everything is inside the Timer.jsx file. https://github.com/callum-laing/react-playground/blob/main/src/components/Timer.jsx ...

I have the following code how I can make contaniner_contant class closer to background_countainer

in the following code https://codesandbox.io/p/sandbox/layout-page-8gvxls you can see there space between class "contaniner_contant " and class "background_countainer" I'm looking to make class "contaniner_contant " closer to bottom without using position...

Background color changes dimensions ???

Can anyone explain me why thus happens ? Is there something in the tailwind I do not understand :/ When I hover over number 2-6 I change border color to yellow and then the size looks same with number 1 which is active with yellow background. I set container grid grid-cols-[repeat(3,min(50px))] grid-rows-[repeat(2,min(50px))] place-self-center gap-4...
No description

having a scrollbar without setting height

On mobile, when the menu opens, it overflows the screen size. Setting overflow-y: scroll doesnt work unless I set height: 100vh, which I cant do because it still takes effect when the menu is closed (the element is still visible, but not expanded). Is there a solution that doesnt require js?...

confusing info

What does min-width :0; in this exemple really does, looks weird cause it's like including overflow-x :hidden; but instead bro really includes min-width which make no sense thou ๐Ÿค”
No description

How can I create a submission page?

Hey there I wanted to recreate this "Contact Me" I found but the issue is I don't really understand how it works or what is required in order to achieve this...
No description

Making a paragraph fit it's content

I have a <p> element, which I'd like to add a max width to, and also have text-wrap set to balance. However, applying these properties creates extra space on the right side of the element, which I'd like to get rid of. As you can see in the pen below, I've tried adding width: fit-content, but it doesn't change anything. What should I do to fix this? Here's a pen: https://codepen.io/samalander0/pen/ZEPLjzm...
No description

How to align the header and footer for a page

1. I have page with two sections divided in b.w , if I want the header on the left to have the background-color of black (same as section 1 bg) and header on the right to have the background-color of grey (same as section 2) Need to achieve something like this - 2nd image...
No description

Centering absolute element above relative parent element

Hi! So I've been scratching my head a bit, I'm making a tooltip that is position absolute that I want centered and above when hovering the icons, and the content of the tooltip is of varying length so I cannot set a static number to hack it. This is the code for the tooltip : `.tooltip { position: absolute;...
No description

Why align-items: stretch, is not working in this case

I want all the cards to have the same height, because they have different titles sometimes might be that a card has 2 rows title hence more height, but I want the other to stretch to it, but it is not working Here is a simple sandbox https://codesandbox.io/p/sandbox/card-ys3pl3?file=%2Fstyles.css%3A75%2C1...
No description

LIST ELEMENTS, EDITING BULLETS

Hello, I'm quite new and I wonder how can make layout from picture below into the one below it. Main question is how to align text height with bullet svg and add spacing between bullet and text
No description

How do I destructure an object that extends multiple interfaces into each of those interfaces?

I'm looking for a way to extract the props, for each interface, from an object that extends multiple interfaces. The use case for this is where I've created a composite component and want to expose all the properties from components A & B on C. ```typescript...

Difference between <Doctype> and <!Doctype>

I recently gave an interview and was asked the question to tell the difference between
<Doctype>
<Doctype>
and
<!Doctype>
<!Doctype>
I searched on the net but there is no answer. Can someone help me with this?...

Responsive component with overflow scroll (Tailwind)

Hello everyone! I wanted an element which takes the entire space available but it should not overflow and increase the page height. I am unable to think of a solution without giving it a specific height which defeats the purpose of it being responsive. Somehow this code worked but I dont know how (Check images, the highlighted part is the "ChatDialogs" component in question) ...
No description

Union of literal types from an array of strings

Hi I'm looking for a way to generate a union type for every string in an array. Let's say I have an array const sample = ["apple", "banana", "grape", "orange""]. Basically I want to be able to get type SomeType = "apple" | "banana" | "grape" | "orange". I need this SomeType because I need to create a function that accepts one of these values instead of typing them one by one like this ```ts...

Having problem with transform-style: perserve-3d

I'm having this problem where i use transform-style: perserve-3d and it didn't have any effect on it, the document said that is apply to that children element, - I tried !important - Tried switch the properties to the parrent and it didn't work I took this code base on Kevin video right here...

@use instead of @import

So my dilemma is I used to import a _header.scss so it could have all the code for the nav in that area but how would I do something like that with @use since sass is trying to get away from @import ๐Ÿ˜‰

How do I overflow/breakout a side menu item label?

Hello, slowly improving my CSS knowledge but trying to work out a "classic" case of breaking out a collapsed side menu's label on hover. I'm not sure how I can achieve this with the current styling and HTML I've put in place so far. From what I've read, I need to make a parent element position: relative and then make the label element position: absolute to break it out? I could be totally wrong here of course ๐Ÿ˜„ . CSS & HTML can be viewed at the link below:...
No description

2024 css reset

Is that actually a good practice๐Ÿคซ
No description

Sidebar is pushing down my content and creating whitespace

CSS, Bootstrap 5 You'll notice I have made it so when I collapse to mobile, the Features sidebar slips under the black highlights box (where it lists engine, suspension, etc. stats). If I made the sidebar collapse to the bottom, I don't think this would be an issue but I need to to appear under the highlights box on mobile. So when the sidebar grows too long vertically, you'll notice this large white space...The DIV on the left is growing to match its neighbor, the sidebar... https://codepen.io/valdortheshield/pen/poYNMMw...