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

Responsive background image that maintains quality

Does anyone have any advice on how to handle background images with background-size: cover; so they can scale up as the screen expands without becoming pixelated? I'm exploring creating media queries to replace the image at large breakpoints, but the issue is that this image is covering the entire background of the page, so I need to scale vertically and horizontally, while accounting for both potentially pixelating the image. I wrote a postcss plugin for this (https://github.com/sygint/postc...

how do you code this design?

Hey guys I need to code this design but I am confused I don’t wanna use table tag, I am going to create a card component but I need to make it structured like a table I may have to make it responsive in future...
No description

How do I recreate this parallax?

I'm not sure how to explain it but I want to recreate the "effect" of the image below, basically it's an image container with a parallax. So, if the image is on the top you can see the top part of it, if it's on the bottom you can see the bottom part of it. I tried recreating that by following some tutorials but it didn't work out
No description

Has anyone set up unit testing for web components created with Preact?

I'm working on a project converting React components to Preact (using preact/compat). We're also providing web component versions of our Preact components using preact-custom-element (https://github.com/preactjs/preact-custom-element), which seems to be the recommended approach (https://preactjs.com/guide/v10/web-components/#creating-a-web-component). We've successfully set up our unit test infrastructure to test both React and Preact components (we're using testing-library and did the aliasing for Jest as seen in Preact's docs - https://preactjs.com/guide/v10/getting-started/#aliasing-in-jest). We'd like to have unit tests for the generated web components as well, but I'm finding conflicting information about this. I've seen some resources say testing-library/preact also tests web components and I just need to be mindful to use @testing-library/user-event for testing user events and @testing-library/dom for shadow dom testing. Other resources say I have to have explicit hydration steps set up in our unit tests to test the web components by importing hydrate from Preact....

Stop words from braking halfway

How to stop words from braking ? so when it needs space whole word just goes on a new line. For example, its T-Shirt on a new line and not T- Shirt. i tried using word-break keep-all, it doesnt work...
No description

Lottie vs Rive for product onboarding interactive presentation.

I'm making an interactive guided tour for a digital product and I'm trying to choose an SVG animation tool. It's nothing very complicated, just some mouse cursor movements and a few graphics that highlight the different screen elements. Which is better suited for a project like this? Lottie or Rive? Or are there any better options that I don't know about?

I know there is a command that can help me achieve this but i cannot find it anywhere.

I just want that when my elements that are inside another element to behave with the proportions of that element, If I give 100% width or height, I want them to have a limit from their outer parent, in this case its not working, I have height 100% and its overflowing, I hope some of you helps me remember that single line of code q_q
No description

Hiding line overflow on "timeline" line.

Hi everyone! Trying to hide the extra line that's coming expanding beyond the first and last bullet points. I was thinking overflow-y might do the trick but no luck. I thought about giving an element a background color and trying overlay it, but that seems hacky. Has anyone dealt with this? Forgive me for the code pen, I don't have pro so the images aren't rendering, and using var for the color but that's the main structure of the css....
No description

JavaScript/webpack - issue with event listener in my index.js file

I am working on the Restaurant Page project from The Odin Project (https://www.theodinproject.com/lessons/node-path-javascript-restaurant-page). I'm new to using webpack and keep running into issues. The latest one is that the event listener in my renderNavbar() prevents the page from rendering, even with Live Server on. If anyone can help, I'd greatly appreciate it. My code is in the src directory of my repo: https://github.com/savvystrider/webpack-restaurant-page

gutter spacing issue

Hey, i have a flow utility class that allows the integration of gutters between elements. i've applied it to a div that wraps around some of the main sections i want to be spaced apart called main-flow. However the spacing between my first two sections (the hero and features section) seems to be controlled by the gutter spacing value of the hero section inside whilst the rest works as needed. I can't seem to figure out what's causing it haha, i'd aprreciate any help, thanks in advance! https...

How can I center the second row to the middle

My goal is to create a up and down carousel but I am trying to figure out how to center the second row of elements shown in the photo. I am currently using tailwindcss to make this happen Carousel ``` const Carousel = () => {...
No description

How to conditionally import css files in react/next

What's the best way to dynamically import CSS files, such as darktheme.css and lighttheme.css, based on the selected theme, when using next-themes, which allows the theme to be specified as either a CSS variable or a JavaScript variable? I know I could do this: ```css [data-theme="dark"] body { color: white;...

Finding what is off with my margins.

When I lower my size to lower sizes, I get a horizontal scrollingbar, and a white area to the right of everything. What is a good way to find what is causing this? If I set Margin to Auto, I get the same area on the left aswell. https://i.imgur.com/P5xNCnC.png https://astrigot.com/...

How to make sticky header without knowledge about its height.

My app structure looks like this: https://codepen.io/H4ds0n/pen/MWZvBGP So i thought ok then, i will make my body 100dvh and ten overflow:scroll and put the header sticky. And everything was ok utill I started to working with react-select and its dropdown. When dropdown shows then weird thing started going on (it seems like html was scrolling down even if target dropdown was body ??) One solution I saw was that people were making header fixed but then the content has to have padding-top with height the same as height of the header. How do I do this properly ?...

Text Transparency

How do i archive the text transparency in the picture, so i could see the background through the text, despite the fact that it's still ontop of the white background. Thanks.
No description

overflow hidden on body

Hey, I see mixed opinions on things like adding overflow: hidden on the body to prevent scroll bars due to decorative elements as shown in this image for example (the blue blob). Is this is a method to use or is it recommended to use something else? Thanks in advance!
No description

Overflow with flexbox resulting in hacky use of calc

I'm having issues finding a more elegant solution that does not result in flexbox children overflowing by not respecting its parent's width. Specifically sidebar-profile-name is overflowing the sidebar with longer names where I'd rahter have it cut off as to not extend onto multiple lines. HTML (Vue 3 with Nuxt) ```html...
No description

Margin or padding

Need more understanding on when do i use margin and when do i use padding. Am a little confused. Especially when its a heading and is not a button. Thank you...