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

Textmarker Highlight Effect (Stretch SVG over width of a span element)

Hey there! I want to make an animated text marker highlighter effect for headings on my website. I made some SVG's that I can animate using stroke-dashoffset, but if I have more than one short word, the SVG only centers in the text but does not grow in width. I tried setting width/height and some other attributes, but when it grows in width, the height grows to preserve the aspect ratio and overflows to the bottom of the span. Can anybody tell me how I can make the SVG "fill"/"stretch" in the width of the container? (Any other improvements of my code are appreciated too.) Here is my code so far: ```css .highlight {...

How to achieve this element/design

Here, I want a tracking element, which will fill based on a particular status or value. I have never done this before, so need some ideas on how to achieve it. This will probably inside a parent container/element which will have other fields as well. But i believe this will be the main part. For practice, I can use 1-5 values and based on each value, the line should be filled.
No description

How to Make a Responsive and Reusable Flexbox Component for Different Number of Boxes?

Hey everyone, I’m working on a component that uses display: flex . Currently, I have 3 boxes that are working fine, and they adjust nicely when resized. However, I want this component to be reusable in other places where I might want 4 boxes, or even just 2 boxes, without having to rewrite the code. My goal is to make the component flexible enough so that I can reuse it for any number of boxes (2, 3, or 4 boxes) . Is that possible? ```...

Styling datalist

In response to Kevin's https://youtu.be/rw30Dw4zcxo ^ I presume it's still not possible to style all the menus for different data pickers, right? So if I want a consistent cross browser UI that follows my style guidelines, I have to recreate these picker menus manually, with HTML semi-hacks and a lot of JavaScript)....

Adaptive lists and SVG line

Hello everyone, can you tell me what the correct HTML structure should be here? Does anyone have video examples of a similar block? Should I make the lists + numbers as one block or separately in order to implement everything with a grid layout? Of course, it all has to be responsive.
No description

a question regarding loops in javascript

why is that when we create a loop for example let friendsInTheOffice = 0; while(friendsInTheOffice < 10) { console.log(friendsInTheOffice) // if we.console log here we get the result 9 friendsInTheOffice++...

How to Approach Responsive Web Design for Different Breakpoints?

Hey everyone! I have knowledge of CSS up to Flexbox and now I'm looking to dive deeper into responsive web design. When I receive a Figma design, what is the best way to plan and structure the layout for different breakpoints (e.g., mobile, tablet, desktop)? Also, I’d like to understand which CSS units are ideal for responsiveness, Could you suggest any resources or strategies to help me learn responsive design effectively? Thanks in advance!...

White background when image loads

Hi. This is my site in Next.js. When the page reloads, a white background is displayed behind the image of the hero section, especially when you visit another page from the navbar like About or Solutions Can we avoid it or reduce this effect? https://visible-paths-six.vercel.app/...

centering scalable text

Hey, i have a design where some decorative text sits behind some content. The decorative text is supposed to stay centered however i can't quite figure out how to achieve this on smaller screen sizes (see images for what i'm attempting and what's happening) The text is supposed to overflow the sides on smaller sizes and have that hidden by the container. I have it figured out on desktop, though that method probably won't be fit for the mobile design due to any overlap making the content do the same as they share the same grid cell. the problem is just scaling it down. My initial thought was using position absolute for the decorative text however since it gets taken out of the doc flow, it has the potential to overlap the header and footer. I'd appreciate any help learning a method for this sort of thing, thank you in advance....
No description

How to add input entries to a list

I'm building a resume builder project with react and I feel a bit stuck on how to add to a list (the resume view) the entries I type into the inputs. I made it work with this code: function EducationField({ setEducationData }: EducationFieldProp) { const [newEducationData, setNewEducationData] = useState({ id: uuidv4(),...

named grid lines not working as expected

Hey, this is one of my first times using grid lines properly for a layout and i can't quite seem to get the layout to look like the sketch in the image with them like i can do when defining the set lines the children go on e.g. grid-row: 1 / -1;. The chidren don't seem to be sitting in their defined areas for some reason. For anyone wondering why i can't group the button in with the text, the layout shifts around at a desktop viewport, this layout is for a tablet viewport. Could anyone please point me in the right direction and let me know what i'm doing wrong? Thanks in advance. https://codepen.io/deerCabin/pen/gONNKLy...
No description

Anyone have an idea for responsiveness for this?

I have this html section "About us". On a desktop i think it looks beautiful but im running out of ideas on what to do with it for smaller sizes becuase it gets absolutely destoryed and messes up the flow of the rest of the elements. Heres an example first pictures is how it looks like when the container with width: 90% and max-width of 1280px has been hit on large desktop screens the second picture is when everything gets messy...
No description

Lightweight swipe lib

Who can suggest very lightweight swipe lib Or perhaps I can do it by myself?...

Let's discuss the relative unit 'em'

I can't wrap my head around the concept of 'em'. Actually, the hole concept of spacing using units relative to the font-size is difficult for me. Let's take a default example: responsive padding of a button. Setting the padding of this button to use 'em' will make it relative to the font-size of the closer parent element, right? ...

What is the down side of FLIP animation method?

hi, when search about FLIP animations in web (https://css-tricks.com/animating-layouts-with-the-flip-technique/) i realize that in paper we should use this method for all kinds of animations which affects layout therefore other elements. so i wonder why very few people uses it because of it is complex or what?...

firefox fouc error

Can someone help me with fouc? I am using macbook pro m1pro and styles arent working on firefox...

SWIPER JS Help

I am trying to make this infinite autoplay swiper. However I have two issues. 1. The slides are not centered even after using centered : true 2. The loop is not working as expected, it is taking too long to load the images which does not look good Here is my code. f and f-c is flex row and flex col respectively...

Is this good practice?

<a href="#"> <button>Read More</button> </a> If I have button and I want when user clicks on it, the user should be moved to other page, is it consider a best practice wrt accessibility? ...
No description

variable within :root variable not changing.

Hey, i recently tried to test out a new design system method i saw andy bell using on https://piccalil.li where a property has a base value stored in :root with variables that can be changed from within the component using it (in this case --border-color). However my variable is not changing as intended. Am i not able to use variables this way? Though it must be possible since he's using a similar syntax (see image). I just can't quite figure out how it's working for him. I'd appreciate any help. Thanks in advance. https://codepen.io/deerCabin/pen/QWXXjKa...
No description

Stacking cards

Hey, does anyone have an idea how this card stacking effect (https://webisoft.com/) can be made? I used position sticky and a padding-top with a calc, but it affects the content "HEIGHT". Any ideas or what would be your approach?