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 to color text so it is visible against any background color?

I have a page (source) where I've got a grid with different colored lines. Is there something I can set the color of the text to so it'll always be visible? I want something like mix-blend-mode difference plus filter invert(100%) from this article. I want the text color to be the inverse of the background, and not to invert the background. I also have programmatic access to the hex version of the background color. I tried color-mixing some, to no avail....
No description

Why is my article overlapping into my nav, and how do I fix it?

Go easy on me, I haven't worked with CSS or HTML since like high school. It could completely be that this is perfectly fine behavior and I'm overthinking it considering the texts aren't mixing, it's just the border going into the navbar that worries me. Outside of knowing how to fix this issue so that, you know, my article section and my navbar section are separated from one another, are there any other glaring cases of bad code practices that I've made here? I feel like I might be overusing variables or classes. https://jsfiddle.net/4vkxybqj/3/...
No description

How to make 1920px container design look good on smaller desktop screens?

I've the design of a dashboard which has a 1920px container size. How do I approach it so the application maintains its appearance on smaller desktop screens as well? Because if i use the same font sizes, spacing etc as provided in the design, the content just won't fit on smaller desktop screens. How to achieve this kinda "adaptiveness"? Would appreciate the help.

State of Front End

I have a really interesting question..... If the future of the front end is making fast and efficient code where we can build anything we like with PWAs, why is the likes of react, angular and some other JS Frameworks which are so heavy and score bad of web core vitals are still being used? Surely it's time that we start moving on from this old technology, the browser for API is now incredible, CSS has caught up to pre-processors, the support for Native Web Components across all browsers is amazing. ...

Why Don't Absolute-Positioned Elements Remain Aligned to Background Image when Browser Widens/Nar?

I put an image on the page to cover 3/4 the browser width (per design). The image is inside a parent <div> with position relative. Also within that div is a container <div class="pins-wrapper"> that I put a few 'pin' elements as <i> elements with display:block; ... here are some snippets: ```html <map-holder><img src="/map-image.png" alt="Its a map!" /> <div class="pins-wrapper"> <i id="pin1" class="material-icons">place</i>...

Pseudo Selector Solution?

I feel silly for asking this, but I'm currently trying to target something on a social site that allows custom code. I've been able to figure most things out. But I'm currently struggling to find a possible solution. On the site, in one section the header has words wrapped around a link. ...

Carousel-style pagination with Modals.

Hello everyone! I saw this site https://lk.zont-online.ru/demo#/. When you click the first card, you have a beautiful carousel with several movable modals, progression bullets. I would like to make them swipeable as well with react-swipeable. I tried to use <Modal> MUI component (for a modal window) and <MobileStepper> (for bullets). But then it would mean that I will have to close the current modal and open a new one which is not a nice option... Do you know how to orchestrate that? Any adive...

Img or Svg element?

Say you have a Figma where the designer have created icons and such. Do you prefer to export them to svg and use them inside an <img /> element with the src pointing to the file, or do you prefer to extract the path and use the <svg> directly like that? It feels like you get more control with svg tag since you can recolour etc, but it also clutters things to have the paths and all?...

Element for <slot>?

Is it possible to not pass a wrapper element to a <slot />? It looks like I have to use a wrapper element, otherwise I couldnt define the slot attribute for my child. ```html <my-custom-element>...

overflow while body does not have an height

why i am facing overflow problem but when i give body height of 100vh the overflow goes away

Doing responsive text by using media queries on :root to change the font size for smaller screens.

While trying to figure out a good way to do responsive text without manually setting font size using each media queries, I came up with an approach. I'll use rem everywhere for font-size and then use media queries on my html tag to change the size of root. This way I can control the breakpoints from one place which is something I've been struggling with. ```css html { @media screen and (min-width: 100px) { font-size: 1px; }...

How to fix this snap dynamic horizontall scroll effect?

I'm trying to make an effect where you firstly scroll verticall, then when reaching a certain point goes horizontally, but then goes back to scrolling vertically, but purely using normal HTML, CSS, and Javascript. So in my code i have 4 sections, When scrolling from section 1 to section 3, vertical scroll is enabled and horizontal scroll hasn't taken effect yet. ...

Issue with Making Child Div Inherit Height from Parent <td> without js or absolute positning.

I'm facing a problem with making a child div (.auto-box) inherit the height of its parent <td> in HTML/CSS without having using javascript or position absolute. Here's a simplified version of my code: https://codepen.io/umanga/pen/JjVMNbJ...
No description

Color png

My restraints are kind of weird, but I have game file icons that I want to port to the browser. Its a crest data, that is two layers of png, background/foreground. The icons are white/black, and then use a rgba function to give the respective layer a color overlay. Is there a similiar way to do this that doesn't have me try to figure out a way to convert the rgba values to css filter functions dynamically during runtime?...

How do i design something like this

I am trying to design this just using div and inside this div ( span ) how can i get the same result??
No description

quotes within html attribute

how does the browser know which quote ends the attribute value?
No description

Card positioning inside a grid container, we want the price and buttons to be the same for each card

https://github.com/callum-laing/shopping-site/tree/main/app As you can see in the image, the button kinda floats around in each card, I want it at the very bottom of each card so it looks aligned as you scan across, instead of how it is now where it looks wavey and clunky.. I'm fine with the item description sitting below the image, and I'm fine with the price going wherever, as long as it's like the button, where it's aligned across the cards....
No description

Trying to align every card so that the button?

in before someone mentions the unfinished title. https://github.com/callum-laing/shopping-site/tree/main/app I'm trying to figure out how I do this, I have no idea really.....
No description

Tailwind help

I use Tailwind and would like to display the 2 Li elements next to each other with a small distance can someone help me with this=? ```html <div class="bg-[#000000]"> <ol class="text-center"> <li>...

Help with side navigation/sidebar

I’m new to JavaScript and I’ve been working on personal projects trying to improve my skills. Could I please know what I’m doing wrong here and why it doesn’t work like it’s supposed to. I’d really appreciate the advise and walkthroughs. https://codepen.io/thatboybubu/pen/poBpzVy...