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

appropriate way to scale svgs

Hey, i have an example hero page centerpiece layout and was wondering the most appropriate way to scale that svg (or any svgs) so they're neither too big or small. The svg came with a pre-set width and height attribute however i removed those otherwise the svg falls short of the wrapper edge which messes with the alignment making it look odd and out of place with things like a header present etc. And if i push it all the way to the right when it's in that state then it leaves a rather abnormally large gap. Removing the attributes made it fill the container, however that makes it too big. I attempted to use scale but it just provided similar issues mentioned above and mostly more i don't know about. This also makes it look huge on a mobile view too....

How to Handle Missing Grid Columns for Mobile Design in Figma?

Hi, so I was watching a Coder Coder project video where she was converting a Figma design to HTML and CSS. The design included grid columns for desktop, tablet, and mobile styles. She was using CSS Grid for the wrapper/container like this: ```.wrapper { --wrapper-width: 1440px; --space-lr: 40px;...

Tutorial for a responsive and accessible hamburger menu

Im still struggeling with the last challenge of the CLR course. Is there somewhere a good course where I can learn to make a responsive and accessible hamburger menu in mobile and a normal menu in desktop. Im struggeling with making the right html and css...

make div height of first child

Hey, how would you limit the height of a div to the first child’s height? In the image, I have a design where I’d like the first piece of content to show but the rest you’d have to scroll down to. I feel this may be something you have to achieve with js, but I also think that there’s a chance it could be possible with html and css, I’d appreciate any insight, thank you in advance.
No description

How to target a tag that has no parents?

I am playing with userContent.css in Firefox which allows me to inject a stylesheet into every page. I have several SVGs that include a @media (prefers-color-scheme: dark) rule to display differently on dark monitors. My issue is the default background for a SVG opened by itself is "transparent", but is effectively white. I tried adding a @media (prefers-color-scheme: dark) { svg { background-color: #0008 } } style, which worked, but it affects every SVG on every page, & generally makes the browser look crappy....

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?...