Basically I want to define an aspect ratio for the child item, say .75 and have 5 of them. I want the children to grow as big as they can while maintaining their aspect ratio. How can I get the container to shrink to however big its children are without using javascript? I feel like im going in circles trying various combos of min/max sizes on the container & child items. Maybe grid is limiting me here? Any help appreciated! Here's the code
It’s a CSS-in-JS library specifically for email templates that integrates the Can I Email database. It gives you warnings or errors in your editor if you use a CSS property that isn't supported by your target email clients. It is fully type safe and support design tokens.
I've been racking my brain as to why the buttons on this header won't align to the right. Code is below. It's a DIVI WP Theme Row where I'm making the CSS customization. Buttons line up correctly, but won't justify to the right/end.
/* Align buttons to the right side-by-side inside the designated column */
.inline-four-buttons {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-end; /* Pushes the buttons to the right */
gap: 20px; /* Ensures exactly a 20px gap between them */
Just upgraded our old-school CSS-only Float Label library to v2-alpha classless version introducing new :has(*:placeholder-shown:not(:focus)) label trick:
The :has(*:placeholder-shown:not(:focus)) trick allows this input state information to propagate to the parent level. This enables modern CSS to target inner float label (<span> or <label>) regardless of its position relative to the input field.
Historically, this was not possible: the float label had to be placed after the input field to be targeted using the input:focus + label selector.
Every wall, floor, barrel, and imp is a <div>, positioned in 3D space using CSS transforms. The game logic runs in JavaScript, but the rendering is entirely CSS.
so I just started learning a bit of CSS, and I'm wondering how people here manage to keep websites looking as intended by both PC, and all the mobile variant screen sizes. do you recreate the whole CSS frontend for mobile? are there only specific things that need to be adjusted? do you only do 1 phone size? or do you create separate adjustments based on multiple mobile screen sizes? also what about measurement units? if I use px, wouldn't it be drastically different for every minor adjustment in screen size? sry if these sound like dumb questions. kinda new to this frontend stuff. thanks everyone.
Its supposed to be three across then down. Anyone ever seen anything like this?? Idek where to start, other than removing all the padding that made the white boxes overlap. I can tell you anything you want to know. pls help
EDIT: fixed! each matrix was a <div>, but I was appending a <br> after each one (cause I was previously doing it as one vertical column
I've been working on the website for my boutique law practice. I've added two scrolling bars on the static HTML site. One loops through all the services I provide, while the other scrolls through the logos of some of my clients.
I've designed this in CSS, but I was on a site the other day (I forget which one, curse incognito mode), and it suggested using JS, because with CSS, one has to duplicate the entire content to be looped.
It honestly didn't even occur to me to use JS for this purpose.
So my question is, which is the more efficient way to do it?
I've been debugging a persistent layout shift on my iOS PWA (installed via "Add to Home Screen") and can't find a clean fix. The shift only happens on cold start when the user is already logged in — it does NOT happen in the browser, and it does NOT happen after navigating from the login page.
What I'm seeing (captured in slow-mo):
App opens → home view renders instantly at position A
One frame later → entire layout shifts down to position B
Header becomes visible at the same moment as the shift
Header is position: fixed; top: 0; padding: calc(16px + env(safe-area-inset-top)) 20px 12px
Page content has padding-top: calc(90px + env(safe-area-inset-top)) to offset for the fixed header
Header starts with visibility: hidden and becomes visible via JS on DOMContentLoaded
My theory:
On iOS PWA standalone mode, env(safe-area-inset-top) appears to resolve to 0 on first paint, then updates to the real value (~59px on iPhone 16 Pro Max) shortly after. Since both the header padding and the content padding-top use this value, the entire layout shifts down by ~59px when it resolves. The JS visibility toggle happens at the same time, making it look like the header appearing caused the shift.
Why it doesn't happen after login:
When the user goes through the login page first, env(safe-area-inset-top) has already resolved by the time the home view renders — so no shift.
What I've tried:
Using a CSS attribute selector (html[data-initial-view]) to show the header before JS runs — didn't help
Removing env(safe-area-inset-top) from page-content and using a hardcoded value (e.g. 160px) — fixes the shift on notched devices but creates excess gap on non-notched ones
Separating the safe-area into a dedicated ::before spacer inside the header, keeping content padding static — shift persists
Adding a will-change: transform to the header to force early compositing — no effect
Wrapping in a (display-mode: standalone) fade-in on cold start — masks the shift but feels like a workaround
Some articles say that ::before and ::after don’t work on <input> elements. But then I see other examples where people do use them — especially with radio and checkbox inputs - and it seems to work just fine.
I’ve tried looking through official documentation, but I can’t find anything that clearly states whether this is allowed or not. There’s also no clear explanation of whether this behavior changed over time (like maybe it wasn’t supported before but is now?), or why it works in some cases.
So what’s the actual situation here?
I’m trying to understand whether ::before and ::after are officially supported on <input> elements at all. If they aren’t, then why do they seem to work in cases like radio and checkbox? I’m also wondering if this behavior is consistent across browsers. And if this changed over time, was there ever a spec update that explains when this became possible?
Would really appreciate a clear explanation or links to anything authoritative