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

image not behaving as intended unless wrapped in a div

Hey, why does this image not respect the fact it's in a flex container and cause the text to overflow unless it's wrapped in a div? This is something i haven't understood for a while haha, thanks in advance. https://codepen.io/deerCabin/pen/Baeewbg...

npm deprecated and vulnerable dependencies

When running pnpm run develop on latest Gatsby version I get the following pop up a bunch of times:
(node:2069896) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)
I also have one high and one moderate vulnerabilities that introduce breaking changes 💀 Anyone sorted this type of thing before and willing to dumb it down for me?...

What are some of the best extensions for Web developers on Vscode?

i would love to have the best set up for my web dev journey

How to access the last value?

So, basically this is my code: ```js function getAverage(scores) { let value = 0; for (let x in scores){...

grid-template-columns, Chrome v. Firefox, Firefox stretching col width, Chrome keeping to content

.photos_div_right is mapping divs which contain <img/> elements: ``` <div className="photos_div_right"> {vehiclePhotos.map((photo, index) =>...
No description

Problem with horizontal scroll

Hello. I'm working on Instagram-like clone and I'm having issue with making stories on home page scroll horizontally on overflow. I've been trying to fix it for quite some time now with no sign of success... So I copy pasted relevant code from my site to tailwind playground (and cleaned code for a bit) to replicate the issue. So this code is code before I started doing anything. If someone could make it work I'd really appreciate it. So what I need is for stories on top to have overflow-x: auto, but to actually work lol. And they shouldn't go behind right sidebar like they do. Also you might need to zoom out a bit to see right sidebar....

Const objects can be modified

can anyone pls make me understand what is happening under the hood?

Stop focus to the embedded form

My client's site has an embedded Formstack form using iframe. The problem is during the page/iframe loading, the browser autofocus to the first field (i.e. First Name textbox). This results unwanted scrolling down. How to fix this?

CSS animation not triggering

I have this animation and upon calling open() with another Svelte component, I can see the toggled-ring class getting added in devtools but it does not cause the animation to play. When I staticly add this class in code, it does play the animation correctly. How can I toggle this animation with JS?

What HTML elements should I use here and what markup order?

Here's what I have so far but really not sure what to go with: ```html <article> <hgroup> <p>...
No description

How to display value or data in HTML with Javascript

I'm currently struggling with displaying values in HTML. I'm recreating the tip calculator as seen in the image linked below, i've marked the parts to show which labels/inputs im talking about. For now im not using the tip buttons since im mostly focussed on learning how to use the DOM and displaying/working with values that way. This also means the totalAmount is empty since its the same as the bill as there are no tips calculated. 1 The input label called "Bill" 2 The input label called "amountOfPeople" 3 the div was which has <div> 0, 00 </div> in it, which is called "totalPerPerson"...
No description

eval()

Why eval js inbuilt function is not recommended to use ??

I can't write javascript or do programming all together

I learned the properties and syntax by watching courses and even built things alongside, but the thing is I can't do it on my own, My head is just getting empty when I open a .js file, just to build the damn thing I can watch others' code or ask a.i a little bit, but it doesn't seem like I am learning anything, nor I am developing any logic on my mind as a developer should, for example, to create an accordion the simple logic is if you click it it's going to open, Click again it's going to close...

How does the CSS priority work with a new React + Vite project?

Hey, I'm trying to learn React, but I wanna implement my scss files and preferably have my own css folders, but for some reason, the main React bundle comes with an index.css, and an app.css (which I swapped into an .scss bundle) but I don't understand a couple things: 1. What's the point of App.css if index.css has a higher priority (so what is inside index.css will overwrite what is inside App.css) 2. Why can't I put my css files inside a css folder/where is the section where I can modify the path towards the css files......
No description

Grid col 1fr behaviour vs percentages?

Hi all. Just struggling with positioning in a grid. My grid has 3 columns, with widths of 20%, 1fr and 20% respectively. The first 3 images above show what happens in a grid when I place the slider in each column. The columns that have widths defined as a percentage seem to behave as if overflow:hidden is applied. But column 2, which is 1fr, doesn't. To replicate this, change line 21 from col-start-1 to 2....
No description

Best use cases for the "lh" unit

Hey, i was wondering what the best use cases for the lh unit are, i see a lot of people use it for spacing and for icon sizes like in this example (https://codepen.io/piccalilli/pen/OJdYxRv), i'd appreciate any insight, thanks in advance.

Issue with JQuery event handler

Hello. I'm animating a navbar which responds to mouse and keyboard events using JQuery event handlers to ensure a proper UX. Most part is done, however there remains one last issue where clicking/focusing on a link and un-hovering right after, the "highlighter element" returns back to its initial location. https://codepen.io/Suggon/pen/MWzqByj?editors=0010 The highligher is a live element conrolled by JS. In order to animate moving towards the target, I used the .on('mouseenter focusin', function() method which is working nicely. Out of intuition, I also used .on('mouseleave focusout', function() for its "reverse" - that's the one which did not work. The apparent reason being that it's listening to EITHER mouseleave OR focusout. So assuming we clicked on a link to gain a focus state, the highlighter doesn't retain itself, since the mouseleave event is fired despite the element being still on focus state....

variables inside the function and order of Precedence in JS

The variable fahrenheit has function scope i understand but it is still not declared (as a let or const )but works why so?? function convertToFahrenheit(celsius) { fahrenheit = (celsius*9/5)+32; return fahrenheit;...

Mystery spacing between 2 flex rows

Minimal reproducible code: https://codepen.io/ifigoinimightdie/pen/xxNeYxg I have a simple flexbox with flex-wrap: wrap. My 1st flex child has width: 100%, so the 2nd flex child goes to a new row. Yet there's a TON of extra spacing between them that has nothing to do with padding and margin. I never set a row-gap either. Inspector indicates a purple region, which I think means the "shrink/grow" area. I tried setting flex: 1 etc. nothing has worked. Full codepen here: ...
No description

vertically position floated element

https://codepen.io/sos909/pen/XWwQZpN how can i make the a element appear at the bottom line of the div not the top while staying on the right