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

JavaScript not counting correctly

Hello, In this code : https://codepen.io/lanszelot/pen/NPPJKoG Inside the for loop workoutHrKarvonen variables counting wrong. Line 42 : intensity/100 this is not counting somehow. intensity not devided with 100 , and it count with intensity itself....

What is the event object in Javascript, how does it work with something like event.preventDefault()?

Hello, can someone explain how the event object passed as a parameter when declaring a callback function works when using the addEventListener function please. For example, when we write event.preventDefault() in a form submission, what does event refers to?...

Why setting display grid without using grid template columns/rows creates new row with space

Hello, I have a quick question. Consider the following codepen. I have set display of grid on my body element and center the items. When I add 2 element inside my grid container, it seemas that the body is divided equally for these 2 elements. My question is why is that so? What is happening here? Like I didn't set any padding nor any gap and the elements appears like that. What creates the space? https://codepen.io/Fakeur/pen/ByyMeMa...
No description

Can we use multiple id attributes in a single element just like we can with classes?

Hello, consider the following: <div id="first second"></div> is this valid?...

Button Align Problem

Hey, do you have any tips on how to better align the button? Right now, it's not lining up properly with the gap between the images. -btw i am using Tailwind https://codepen.io/Redcaus12345/pen/ByyMqLE...

Portfolio website ratio and zooming problems.

Hello, I'm trying to make the background of my portfolio. But I realized that the page only maintains the correct ratio at 75% zoom in the page. On the other hand, when zooming the website less than 75%, it starts to scale to the top left corner instead of the top middle, which is what I want. I'm a beginner at HTML/CSS, so I may have chosen the wrong unit at the start and actually have no idea about the ratio properties. Here are the page.tsx and the global.css. There are also other components, but I think they are not related to the problem here. There are still more problems with the pattern and navigation bar when scaling, but I think tackling it step by step is much easier. ...
No description

figma to website is looking worst !! how can we develop it proper design.

so i made design in figma. on the frame of slide 16:9. W 1920 x H 1080 so when frontend guy developed the design it looked not the same. what can he do to develop it properly like the same. we both have different laptop i have macbook pro m2 pro and he has realme laptop resolution of his laptop is 1920x1080 but in chrome inspect tool it showed he has 692 height and 1536 something of width. technologies i think it is tailwind that's all i know. what i exactly want is the website to look like my design like 100% if not 100 then at least 99 😭...
No description

Tailwindcss not applying in react project

Good morning I am working on a react project using vite. but suddendly my tailwind styles stopped applying, i've tried everything i could but i couldn't still resolve it...

textarea/input

how do i give width and height to textarea/input? should i use cols and rows attributes should i use css to give them width and height...

Beginner guide NodeJS

Hi, i'm looking for someone to guide me a bit into NodeJS

Text Truncate in CSS

https://codesandbox.io/p/devbox/hf4xqz I have a dropdown component using the Shadcn library. I want to limit the no of letters it can display, Once the length crosses certain threshold, I want to use truncate and display eclipsis. Do we have only way to do it using max-w or do we have any better solution for it. Can you please let me know? I have attached codesandbox...
No description

Help with JS Method Commenting (+ Feedback if u want)

Hi, this isn't a question to a specific Problem more a newbie asks veteran for general advise 😄 I finished my second javascript homework, a IdeaList. Last time they said we should comment/describe methods that are not self explanatory. ...

Dynamic header

I want to make header that automatically switches between desktop/mobile modes. Logo is constant size. Social buttons are constant size. So everything depends on size of nav links and screen size. If all nav links fit into single line, keep them. Otherwise show burger button and put nav links into modal window....
No description

daily in google-meet at 9 AM CEST - dev TODO talk

Just want to discuss at the beginning of the day with somebody what I'm going to do and also would like to know what are you coding Next.js TypeScript Tailwind meetings every day for 5-10 minutes...

How does min-content differs from max-content?

Hello, from what I've read and understood, min-content is used to make text wrapped so there isn't any overflow while max-content doesn't make text wrapped and can cause overflow. Can someone confirm if that's correct and if there is more to that please. I often see people use it with width property, min and max-content are only used with width? Is it only used to text or for containers also, like div?...

datetime-local value firefox

hi all, i have a problem with the datetime-local tag with firefox. https://jsfiddle.net/wLtbyx7p/ i have an empty input. i use the "native interface" to select the date the input is now "12/05/2025 --:--" since i haven't selected a hour yet. => since it is not a valid date, the value isn't changed and is still a empty string....

@layer in SASS

Hi im just wondering if there is a plan to implement @layer in sass ? if not, what is the alternative in sass to scope or work on specificity ? im not into BEM and i dont see any other solution. I would have to then leave sass , but i really appreciate the use of sass variable and mixins. i dont think there is those on css right ?...

Understanding Concepts

Hey guys , im learning by myself right now JS , i wanna hear your thoughts and explanations , should i get help from chatgpt to explain me concepts (without showing code ex) or should i not do that or use other material like official docs , mdn etc..

Scattered Grid Help

Hello! I would really appreciated it if I could get some insight/guidance regarding the easiest way to do a “scattered grid” / “asymmetrical collage layout.” I will attach two pictures. The first one is a full masonry layout that is symmetrical in the way that the spacing is even, not random. Easy to work with. The second one is my target, where images not only have slightly different sizes, but "random" placement....
No description

Feedback on user-info web page

Hello, can anyone give any feedbacks of what can be improved here please. I don't know yet what to add to the side-bar, maybe some links but even if I add some, it will be 3,4 links, there are still lots of space left, any recommendation to fill that please? Also, is there anything I can add to the section below "My profile" please, doesn't it feels void?...
No description