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

When to use rem and em

Hello guys, I'm currently learning how to build responsive design and I came across that we should try not to use the px units to build responsive designs; only keep that for small things, like logos etc...We should try to stick with units like ch, rem and em. From what I understand, rem is the font-size relative to our root element, the html element and em is the unit relative to the nearest parent element. But when should we choose to use rem rather than em....

How do grid lines work in CSS grid?

Hello guys, sorry to disturb you all; can someone explain how the CSS grid lines work please; the thing I'm not understanding is why the grid lines (represented by the black line) doesn't start on the edge of the rows or columns but before the rows or columns, like in the gap, I'm very confused about that. It is like if our grid-container has a padding and the black line is drawn in this padding. Second is why we always have 1 more row grid line or 1 more column grid line that actual number of rows and columns....
No description

forms | action and method

Hey, i have a couple of questions about the action and method attributes for forms- 1) With action, what necessarily does sending data to other html/pfp files etc do? I can imagine it's so you can use it with js that's hooked up to the page it's sending to to either use it in a query or display it on the page. This makes sense to me since i imagine you'd have to use a database or something similar to retrieve data between pages without this functionality. let me know if i'm wrong though please. 2) With the GET method, what's the function of appending the data to the url? What does it allow you to do?...

<audio>

I'm not sure if I'm right here. I want to trigger a "picture-changer" if the ausion is clicked to play. This is allready working. But I want to stop the picture-changer if someone clicks on pause or the audio ends. Also this is working. But if I click the play-button in <audio> again, the picture-changer is not working anymore. How can I make a question like "if the play-button is clicked --> pictors are changing, if "the paus-button is clicked or the audio is at the end, then stop the picture-changer, but if you click the play-button agein, then the picture-chanter shall work againt?...

Image Positioning

How do I replicate the original image as presented in the figma ? i need help...
No description

How do you transition a height based on the height of its children?

I have this: https://codepen.io/Lko3001/pen/RwXEBea I don't want any transition on the children, I just want to transition the height of the parent when the content inside of it changes. Is it possible to do it with only CSS? Maybe with some modern CSS stuff? I tried with view transitions but it didn't work, but maybe I wrote something wrong...

Why does a drop-shadow get cutoff when applying it to the path of an svg?

I have two identical svgs. One having a drop-shadow applied to the <svg> element and another with the same drop-shadow applied to the <path> element inside the <svg> element. The svg with the drop-shadow applied to the <svg> element is fine. The other however get's cutoff. My question is why?...
No description

Container grid system using react CSS modules, full-width being overridden by content-grid

I was following the "A new approach to container and wrapper classes" and trying to hook it up to a react project using CSS modules. However, when I use my full-width class it gets overwritten by the content-grid class. Is there an incapability with React CSS modules and this type of layout? Or am I missing something? ```.content-grid { --padding-inline: 2rem; --content-max-width: 120ch;...

Make grid container like having margin-top

Here my grid item (.box) are overflowing to the top-side of the grid container (.wrapper). The problem is I don't want the .box looks overlapping with the .wrapper previous sibling (.first-item). One thing I can do to solve this is with adding some pixels for margin-top to the grid-container. But is there another way so the spacing can be dynamic to the height of overflowing .box? ...
No description

quick css questions

Hey, i just a few quick questions 1) is there a way to select an element based off of whether it's a certain count of one on the page? I know nth-child and nth-of-type do this, but only if the elements are siblings. If i wanted to select the 3rd p element on the whole page for example, would that be possible? maybe it's with that of selector that's floating around? 2) I've noticed that if you have a list inside of another list, the child's ul/ol element will have it's user agent margin removed, what causes this? is it because of the way sub-lists work? https://codepen.io/deerCabin/pen/wvVRoVG...

svg sizing

Hey, just a couple questions about how sizing of an svg works- 1) If there's no viewbox and you try to resize an svg in css, the content within the svg won't scale with it, why is this? (example in codepen) 2) If you have an svg with a viewbox of 0 0 100 100 and let's say there's a circle in there that has a r, cx and cy of 50 to center it within the viewbox, if you resize the svg with css, what makes the content scale up/down since the svg is now larger/smaller than the viewbox, i'd expect the content to be cut off?...

Create this Layout

I am struggline to create this layout from a figma file. can anyone help out please?
No description

side index is not sticking. what i'm doin’ wrong ?

https://codepen.io/kev00690/pen/zYgpNVV i did not know how to put index on side so i put main content in one container and side part in one container. and did display: flex; and justify-content: space-between; IMAGE IS FOR REFERENCE....
No description

CSS Custom Props Good Practice

First off, I recently found out that local custom properties in CSS can be inherited by child elements, and I’m honestly blown away 🀯. Second, I have a CodePen with a snippet that illustrates my question. Is it considered best practice to set custom properties on elements and then modify their values with inline styles? Everywhere I look, people advise against inline styles, so now I’m unsure if this case is an exception or if there’s a better approach. I set --_hue: 10 local custom props inside .card element, then i changed the colors of the two others elements with inline-styles...

svg sizing when in img tag

Hey, so if i have an svg in a file, e.g. ```html // example.svg <svg width="10px" height="10px" viewbox="..."> <path></path>...

Flex wrap issue

so i have this flex element which is great on large screens, but on mobile it isn't so good even tho i have flex-wrap:wrap here's the code: ```.oAuth-logins{ display: flex; flex-wrap: wrap; /* justify-content: space-between; */...
No description

How to make a fixed position element responsive

Hey guys, I'm trying to make the width of this searcg bar responsive to its parent but it does not work accordingly 😦 Any tips on how to get this done right? ``` <DialogContent> <Box position={'relative'} width={'80%'}> <Box position={'fixed'} zIndex={10} width={'50%'}> <SearchBar name={''} placeholder={'Search'} />...
No description

Semantic HTML Question - Does paragraph text have a parent/child relationship with headings?

I am looking for a semantically correct answer. It likely doesn't matter that much, but I've been wondering this for a while. If I have a heading structure like: H1 Body Text...

Testing workflow

I'm trying to figure out the best workflow for testing devices and browsers- I know it differs from site to site, and project to project but I just wondered if anyone had any tips on how they make it a smoothish process. And I'm not at the scope where I want to pay $20/month for a service like BrowserStack. I have a couple older iphones, a couple older galaxies, MacBook and two windows pcs, an iPad and a Samsung tablet. Different versions of their respective oS's. But i dont have all the browsers on all of them. Since any browser on an iPhone or iPad uses safari engine that cuts down on a few, but testing Safari, Samsung internet, Opera, Chrome, Firefox and Edge (6 browsers) as the bare minimum on say 6-7 devices is lots to do. ...