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

Background

Hey guys, I wanted to ask: should I just use this image as the background of the section, or should I code it to look like this? Which method is better?
No description

Why can't I see the #333 background?

https://codepen.io/abhioncss/pen/WbQaYmJ I understand the z-index is working because I see the text inside the div. But how do I bring the #333 background forward and use inset: - 10px on the pseudo element? Should I make a wrapper element around the div and set z-index relative to that?...

BEM Advice

I'm trying to use BEM in CSS, but I'm not sure how I should name these classes: I have a task element used throughout a block (game) and an input element that appears inside both sub-sections of the game (solution and question screens). How should I name the elements properly? My current structure: ```html <div class="game">...

Making Absolute-Positioned Div Layout Responsive

https://codepen.io/Redcaus12345/pen/yyYRxRL I want to code this design. So far, I've done it using absolute positioned divs, but I was wondering how I can make it responsive. Can someone help me?
No description

Import not working

"use client" import { useEffect } from 'react' import { useRouter } from 'next/navigation' import { InstantRedirect } from "@/utils/redirect.js"...
No description

Cannot hide elements immediately

i have some transitions on transform: translateY, consequently, applying a hide class (which has visibility: hidden) doesnt hide stuff immediately, when I remove transitions from transform, then the stuff hides "immediately" what should i do? are there any alternate to translateY? (i cant find any online)...

SCSS/CSS Intellisense suddenly broken by Some Sass extension in VS Code

Hello everyone. I am asking for help: The Some Sass extension in VS Code suddenly stopped working, and all Intellisense for SCSS and CSS is now completely broken. Here’s the full debug output I get: `[Info - 10:21:45 PM] Workspace root file:///c%3A/Users/PC/Desktop/astro-news-website...

How to transition height?

Hi guys, I have a simple layout with an outer box and an inner box. Is it possible to animate the height of the inner box while ensuring it does not extend beyond the outer box? The height of the outer box may vary depending on its content. Thanks. ```html <style> .outer{ height: 300px;...

transform: translateY magically perfect center

Hey, I have a question, when we apply flex box center properties using align items (or justify content if flex direction = column), our center essentially starts from the top of first element. As a result, we dont get perfectly centered elements. But, the moment we put translateY(-50%), its perfectly centered, I would appreciate a good explanation on what exactly is this percentage about? that -50% puts it in center: https://codepen.io/latuza/pen/PwPyPXJ (uncomment line 12 to see what im saying)...

Static files and Public folder

Hello, I have a question. I know that static files are files that aren't going to change in our back-end, like css files. Now, the purpose of the public folder is to "host" these static files so that anyone can access them? In express.js, we explicitly need to use a middleware to do that, I didn't understand why though, I mean does this bring? Automatic MIME types?...

CSS Grid: Intrinsically wrapping grid items in groups of two or three?

I have a series of grid items that I'd like to wrap cleanly so that I don't get hanging card “orphans”. Currently I have 4 items, but there could be 3 or 6 or 8 items (let's ignore 5 and 7 for now). With four items, I'd like to have either: 1 × 4, 2 × 2, or 4 × 1 layouts (but not 3 + 1)...

Odin project

Please expert here How do you people see Odin projects and who recommend using it...

<ASIDE> vs <NAV> for Sidebars, which one is semantically better?

I’ve been researching sidebars as the main navigation for my new project, and it’s left me in a bit of an existential crisis. Even after going through the accessibility docs, I’m still not sure which approach I should take. My Understanding. My understanding is that, semantically speaking, if the sidebar is the only navigation in a website then it should use <NAV> as that's the correct approach in terms of accessibility....

`1fr` as min value in `minmax()` doesn't work

https://jsfiddle.net/KonerDev/uthpkoL2/13/ The box should be 400 pixels wide, and if the browser width is smaller, the box should fill the entire width of the grid. WHY doesn't this approach work?...

`table-layout: fixed`: how does it work?

I have a table that's built by our platform that uses table-layout: fixed. I'm trying to shrink some of the columns so what I'm doing is using width: 40px on some of the column cells. The issue is that while the cells shrink, they don't actually become 40px. Even setting a max-width: 40px does nothing. (and no, it's not getting overridden). The confusing part is using relative units like % or vw does change the cells widths down to that actual size I set it as far as I can tell. Why is that?...

Web worker context vs browser/main "thread" context

fetch("/data.json").then(res => res.json()).then(data => {
console.log(data);
});
fetch("/data.json").then(res => res.json()).then(data => {
console.log(data);
});
...

Array().fill acts weirdly

```js // Option 1 function initialize() { let matrix = new Array(3).fill(["-", "-", "-"]); return matrix;...

I find this impossible to achieve

I'm trying to horizontally align an arbitrary number of <li> elements so they're all the same width as the widest one, and so they wrap to a new line when needed. I need to do this without hardcoding any values in the CSS. Here is my CodePen: https://codepen.io/cos4ni2s/pen/KwdBVyz?editors=1100...