Advertisement Β· 728 Γ— 90

Posts by Lars Ejaas πŸ¦‹

My hit-rate with AI and CSS is really bad!
I love using AI, but for styling it's just too weak yet IMO.

4 months ago 1 0 0 0

Damn... I had no idea!
Here I was: adjusting font weight manually in dark mode...

4 months ago 0 0 0 0
Promotional graphic announcing a new frontend developer job at BoligPortal, featuring a teal background on the left with a stylized illustrated portrait of Lars Ejaas smiling, labeled β€œFrontend Developer” with a handwritten signature beneath. The center shows a tilted Polaroid-style frame containing the BoligPortal logo with an orange house-shaped icon and white user figure on a dark blue background. The right side displays a modern industrial-style office with large glass walls, exposed red brick, wooden desks, indoor plants, and soft natural lighting. A bold white outline label reads β€œNEW JOB.”

Promotional graphic announcing a new frontend developer job at BoligPortal, featuring a teal background on the left with a stylized illustrated portrait of Lars Ejaas smiling, labeled β€œFrontend Developer” with a handwritten signature beneath. The center shows a tilted Polaroid-style frame containing the BoligPortal logo with an orange house-shaped icon and white user figure on a dark blue background. The right side displays a modern industrial-style office with large glass walls, exposed red brick, wooden desks, indoor plants, and soft natural lighting. A bold white outline label reads β€œNEW JOB.”

Two weeks in at my new job at BoligPortal 🏠 β€” and what stands out the most is the team spirit πŸ™Œ
It’s been great joining a group that collaborates so naturally and builds things with real energy.
Excited for what’s ahead! πŸš€

5 months ago 1 0 0 0

This is sooooo satisfying 😌

5 months ago 1 0 0 0

This reminds me of some edge-case I've seen recently in Chrome πŸ€” It definitely wasn't about RTL - but of course I forgot how to trigger it πŸ˜’

6 months ago 2 0 0 0

IMO it takes a bit more optimization to make things really smooth.
Especially on mobile devices.
Prefetcing and prerendering can really help a lot!

7 months ago 2 0 0 0

The animation tab in Chrome dev tools instantly becomes your best friend πŸ˜…

7 months ago 1 0 0 0

Love it Salma! 😍

The view transition API is soo nice!

Been playing a lot around with this on my own page as well - makes the look and feel of multi-page apps/pages sooooo much nicer! 😍 πŸ₯³

7 months ago 2 0 0 0
Advertisement

This is SO clever! 🀯

7 months ago 1 0 0 0

Congrats! This sounds like a powerful combo πŸ’ͺπŸ₯³

7 months ago 1 0 0 0

But I really like the idea of inserting a breakpoint on pagereveal - will take a stab at that!

7 months ago 1 0 0 0

Thanks! NO, my portfolio is certainly not a minimal reproduction - quite the contrary! πŸ˜‚
I better start off with something simpler than the blur-background - this one is quite a bit more complex - but I also get this weird blink of "no blur" on my header menu on desktop.

7 months ago 1 0 1 0
Lars Ejaas | Cycling Roadrace in Hammel, 2009 πŸƒβ€β™‚οΈπŸš΄ Explore pictures from my years as an athlete. Competing in a Danish elite road race in Hammel, Denmark - 2007.

The easiest way to understand what I mean is to go to my page at:
larsejaas.com/about/cyclin...
and then navigate to the next image using the arrow-buttons.

7 months ago 0 0 2 0

The issue is probably in terms of transparent layers and backdrop-filter.

I would like my blur background to look like it persists across navigation to a different URL - I just haven't found a way to do this yet...

7 months ago 0 0 1 0

I am using CSS Modules and found it a bit difficult to control the CSS bundling.
So, I ended up adding a style tag manually in the top of my head where the cascade layers are defined. This works well πŸ™‚

7 months ago 0 0 0 0

Finally got around to taking a look at your entry!
Makes sense!
I am in Astro actually - but prefer CSS Modules over <style> tags - totally a personal preference...
But your info here on local/global scope could have helped me out!
Maybe include info about view-transition-class here also πŸ’‘πŸ˜€

7 months ago 0 0 1 0

CSS Modules are simple but super powerful if you lean into these tricks. πŸš€

7 months ago 0 0 0 0
CSS styling:
:global(:root[data-darkmode="true"]) .someLocalClass {   
   box-shadow: unset; 
}

CSS styling: :global(:root[data-darkmode="true"]) .someLocalClass { box-shadow: unset; }

🌍 Global styling
Most of the time, you’ll want to keep styles local, but sometimes it’s useful to reference global classes, IDs, or states.

You can combine local and global selectors with the global keyword.

Here, `.someLocalClass` remains local, but its style adapts to a global state.

7 months ago 0 0 1 0
Advertisement
Terminal command:
npx tcm -p src/**/*.module.css
// geneares a *.d.ts file for all *.module.css files

Terminal command: npx tcm -p src/**/*.module.css // geneares a *.d.ts file for all *.module.css files

πŸ›‘οΈ Type Safety
If you want full type safety in TypeScript, you can generate `.d.ts` files for your CSS Modules.

A package like typed-css-modules github.com/Quramy/typed... can do this automatically for all modules.
Now classnames will be typed, avoiding typos and giving you editor autocompletion.

7 months ago 0 0 1 0
CSS showing:
@layer components {   
  .button { 
    font-size: 1rem
  } 
}

CSS showing: @layer components { .button { font-size: 1rem } }

πŸͺ„ Cascade Layers Tip
Wrap all component styles in the `components` cascade layer.

Anything outside cascade layers has higher specificity.

This makes it easier to override component styles from the outside when needed.

7 months ago 0 0 1 0
CSS showing:
:import('@components/buttons/button.module.css') {   
  fadeIn: fadeIn;   
  fadeOut: fadeOutFast; 
}

.awesomeButton {
  animation: fadeIn 400ms ease-out; 
}

CSS showing: :import('@components/buttons/button.module.css') { fadeIn: fadeIn; fadeOut: fadeOutFast; } .awesomeButton { animation: fadeIn 400ms ease-out; }

🎬 Importing animations

CSS Modules let you import from other `.module.css` files β€” even keyframes!

The import syntax allows for renaming the keyframe animations - or use them as-is.

Now you can use the animation as if it were local.

7 months ago 0 0 1 0
CSS showing:
.closeButton {  composes: button from '@components/buttons/button.module.css';   color: red; }

CSS showing: .closeButton { composes: button from '@components/buttons/button.module.css'; color: red; }

πŸ”„ Re-using classes with `composes`
You can β€œspread” one class into another using `composes`.

Works a bit like Sass mixins but stays inside the CSS Modules ecosystem.

7 months ago 0 0 1 0

βœ… Preprocessors?
CSS Modules are often paired with Sass, but native CSS now supports nested selectors in all modern browsers, making Sass less essential.

If you previously relied on Sass mixins for reusable styles, you can often achieve the same with reusable classes using `composes`.

7 months ago 0 0 1 0

πŸ’… Using CSS Modules in your projects.
CSS Modules are often underrated. Looking for an alternative to Tailwind CSS? They’re one of the cleanest ways to keep styles scoped to your components and avoid global CSS conflicts.

Let’s go through some practical tips. 🧡
#DeveloperTips #CSSModules

7 months ago 1 0 1 0

No worries! It helped a ton with your working example! I could exclude a lot of previous unknowns pretty fast πŸ˜ƒ
Number 14? I would love to take a stab at an issue if I might be of help!
I still have a thing that bothers me with transparent layers with a background blur filter applied πŸ€”

7 months ago 1 0 2 0
Advertisement

Thanks! No bug here: just needed a small syntax tweak when using class declarations inside CSS modules πŸ˜€ See my post above...

7 months ago 1 0 0 0

πŸ‘† @vtbag.dev - finally found out why I couldn't make this work - but took some time to figure out how to get it working πŸ˜€

7 months ago 0 0 1 0

::view-transition-image-pair(.test-class) {
animation-duration: 1s;
}

it will fail!

I have to use this syntax:

::view-transition-image-pair(:global(.test-class)) {
animation-duration: 1s;
}

So now it works πŸ•Ί
view-transition-classes must be globally scoped!

7 months ago 0 0 1 0

So, took a stab at this tonight (you know - friday night fun!).

And love and behold: I FINALLY found out why!

I use css modules(with no preprocessors).

If I do a declaration like eg.:

::view-transition-image-pair(test-name) {
animation-duration: 1s;
}

it will work just fine.

But!...

7 months ago 0 0 1 0

I will take a deep dive into the transitional rabbit hole and return if I find something worth sharing πŸ˜‰πŸ°πŸ•³

7 months ago 1 0 1 0