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

How does this example from React documentation work?

Hello guys, I'm reading the new React documentation but I don't understand a little thing. In the step 5 in this page https://react.dev/learn/reacting-to-input-with-state the handleSubmit function updates the status state 2 times (one at the top level and one inside try/catch). How is that possible? Shouldn't state be updated with just the last value? I tried to add a new counter state and increment it by 1 every time that setStatus is called, and it actually gets incremented only by one per submit, as I expected... so why is setStatus different?...

Working VS Code extension for Custom Property intellisense

Hello! So I've been trying about 3 or 4 different extensions to get intellisense going for custom properties coming from an external file, when working with multiple .scss partials, but apparently, I'm not setting those correctly or they just don't work. You guys have a working setup that has been working for you ? What settings were tweaked to get there ? ...

Force Grid Box to align at top

New to Discord so please forgive me if this post is not as it should be. I'm having an issue with content alignment within a grid box. The first image illustrates my desired result of a page using a grid. The Menu, Heading, and Footer are not part of the grid structure. I have 10+ pages that use this same structure. The attached text file is a mixin I use to include the grid structure. The four parts of the grid can all be of variable height. The problem is related to the height of the page_Table area. The area is populated with a dataTable from my database. Because the table length is greater than the height of the image everything looks fine (2nd image, i.e., table aligned to the top of the grid area). But, if one of the alpha letters is selected, which has fewer rows than the base table (3rd image) the table appears in the middle of the grid area....

border-image problem (solved)

I'm using border-image to add a linear gradient border to the bottom of an image. However, the top corners of the image are also showing the border, even though I only want it to appear on the bottom. Here's an image that illustrates the problem: !...

Custom hr in CSS

Is it possible to achieve something like this with css ? I dont even know how to start with this.

Need help with some layout formatting... CSS.

Hello! I have a large ellipse I am using for some layout design. It is larger than the page size and overflows off the top of the page no problem but then the bottom of the page extends to scroll down to the bottom of that image... Here is a screenshot from Figma of what I want it to do:...

Using default values from a JSON file

I have this issue on the live version: https://cozynova.online/mvptimer/ I would like to use the default values from a JSON file if the user inputs nothing, at the moment I assume values of true/false, but I feel like I'm not doing it correctly. ...

Preventing Flexbox 'runts' with CSS

So on our website, we often have relatively long menus where flex-box is the ideal way to arrange a number of options. The only problem arises when the last item is all alone and it looks weird and unbalanced. We have avoided this in the past basically using 'magic numbers' as it were, but I'm working on a more general solution. Here's my codepen: https://codepen.io/crowjake/pen/vYzzQxY My solution is OK so far (custom properties and nth-of-type stuff), but is pretty restrictive and will require media/container queries to be made responsive, which somewhat defeats the point of flexbox....

Scroll-margin-top: Why overflow hidden has an impact

So I've worked out that removing overflow: hidden fixes the problem on at least one of my sections that were ignoring the scroll-margin-top property On at least one other it has no impact. I was just wondering if anyone had any ideas why that might be? Does it scroll to the contained elements that have overflowed and aren't visible?...

How to design a page from jpg design file?

Hey. I am trying some frontend mentor challanges, but it comes with just a .jpg file showing how it should look. Whats your best app to detect pixel sizes or to make it work like in cssbattles where you can drag a line showing what to change? (I am using Windows 10 if that matters)

`CSS.supports` not working for `transition-property: grid-template-rows`

I'm trying to implement a Collapse/Expander element using CSS Grid by animating grid-template-rows. However, I need to know if it's supported first, but it seems like CSS.supports always returns true for transition and transition-property. e.g. ```js CSS.supports('transition: grid-template-rows') // true CSS.supports('transition: grid-template-rowssss') // also true CSS.supports('transition-property', 'grid-template-rowssss') // also true...

javascript function not executing

please, can anyone help check this code snippets linked below? i have two functions in particular not executing:
1. displayCurTime()
1. displayCurTime()
2. displayMin()
2. displayMin()
...

Scroll animation overlapping not letting me interact with a button

Hi! I made a scroll animation with GSAP (over a year ago so I might not be remembering something), some sliders that appear and disappear with scrolling. The thing is for some reason only the last one is reachable, you can only select text or interact with the last one, because inspecting it seems to be above the other ones all the time. I need to put a button in other slider that is not the last one and I can't press it, I tried adding z-index: 999 to the button but still nothing, does anyone have a solution to this? Here's a codepen as an example...

Bubble effect in CSS

I wonder how to replicate the exact same result as in the original picture I try inner shadow, but when I increase the blur it's spread all around the circle, meanwhile here top-left, and bottom right are clearly transparent, also with linear-gradient is not quite the same...

Carousel from a masonary grid

I have a masonry grid. When I click on any image I want to open a carousel. with pagination. I'm using vanilla js. Is there any library I can use to achieve this? Sorry if this is very basic question....

Convert script from jQuery to Vanilla JavaScript

Hello. I was wondering if anyone could help me to change this jQuery AJAX Script to vanilla javascript. I don't really feel like importint a whole library to use only AJAX for my forms so i would appreciate it a lot if someone could help. ```js $(document).ready(function() { $('.myForm').submit(function (event) { var data = $(this);...

Customize input pattern not matching popup

Is there any way to customize the popup that appears when input does not match pattern?

Responsive grid column count w/o using media queries?

I want a responsive grid where columns shrink and grow to fill the container: on small viewports, I want one column; on medium viewports, I want two columns; and on large viewports, I want a maximum of three columns. This is easy to do with media queries as shown here: https://codepen.io/academyoff/full/xxaJabZ But is there a way to achieve this without media queries?...

How to update HTML text via javascript without distrubing css

i been using certain properties like innerText to update HTML text but for some reason CSS (font color, size etc) is not applying on those text. How to fix it?