Practical
CSS for People who Avoids CSS
@albertalrisa
SODA Inc. 勉強会
Aug 4th, 2025
Who is this session for?
  • People who are not used to (or avoids) CSS
  • Experienced FE devs might find how this slide is constructed more interesting
This session will be in English but a Japanese slide note will be provided.
(translated by Gemini)
Layouting
Grid
Grid template
              
                .container {
                  display: grid;
                  grid-template-columns: repeat(4, 1fr);
                  grid-template-rows: 50px 1fr;
                }
              
            
A
B
C
D
E
F
Column and row size
Flex
                  
                    1fr
                  
                
minmax
                  
                    minmax(100px, 1fr)
                  
                
Repeat
                  
                    repeat(3, 10px)
                  
                
Implicit size
                  
                    auto
                  
                
Let's try!
A
B
C
D
E
F
Styles
Grid is useful for table layout
Payment for Order #1111111111
-¥ 12,345
Refund from Order #9876543210
¥ 1,234
Refund from Order #1234567890
¥ 123,456
What about flexbox?
Use both!
@container
You might be familiar with @media query
              
                .product-list {
                  display: grid;
                  grid-template-columns: repeat(3, 1fr);  
                }

                @media (min-width: 768px) {
                  .product-list {
                    grid-template-columns: repeat(5, 1fr);
                  }
                }
              
            
Now we can apply it to any container!
              
                .product-info {
                  container: inline-size;

                  .name {
                    font-size: 1.5rem;
                  }
                }

                @container (width > 512px) {
                  .name {
                    font-size: 2rem;
                  }
                }
              
            
We can create something like this
GEL-KAYANO 32
GEL-KAYANO 32
Asics
Size Info
US
8
JP
26cm
EU
41.5
UK
7
Running
¥ 20,000
22,000
Does this replace @media
(or why not just use @media)?
Again, use both! They serve different purposes.
Utilities
user-select: none
Sometimes, these happens
NEW!
Watermelon
Watermelon
¥1,200 ¥1,550 / kg
💭 BRAND NAME
Today's Promotion
50%
user-select: none to the rescue
              
                button {
                  user-select: none;
                }

                .product {
                  /* ... */

                  .banner {
                    user-select: none;
                  }
                }

                .header {
                  user-select: none;
                }
              
            
However...
Don't abuse it
isolation: isolate
Have you ever experienced this?
Isolate helps solve this
Without isolate
8
7
2
1
0
With isolate
8
2
7
1
0
Applying isolate is easy
                
                  
1
7
                
                  
1
7
Nested CSS
You might be familiar with this in SCSS
              
                .button {
                  translate: 0 var(--translate-y, -5px);
                  transition: translate 100ms;
                  padding: 0.25rem 1rem;
                  border-radius: 0.25rem;

                  &:hover {
                    --translate-y: -10px;
                  }

                  &.primary {
                    background-color: oklch(55.3% 0.195 38.402);

                    &:hover {
                      background-color: oklch(70.5% 0.213 47.604);
                    }
                  }
                }
              
            
This is plain CSS!
Styles
One difference
              
                .button {
                  &--text {
                    /* In SCSS this produces .button--text */
                    /* This is not possible in CSS */
                  }
                }
              
            
Solution?
Please don't.
Further Reading & Resources
To practice flexbox and grid alignments
More detailed look at @container
(since there are a lot of hidden intricacies)
Further Reading & Resources
If you're more concerned about design
7 Practical Tips for Cheating at Design
by Adam Wathan & Steve Schoger
Refactoring UI (paid resource)
by Adam Wathan & Steve Schoger
Further Reading & Resources
How this presentation was made
Questions?
Thank you!
You can find the slide PDF, including speaker notes here:
https://github.com/albertalrisa/20250804-practical-css
(And the source code, but I can't promise the slide source code is tidy)