(AKA things you may have missed
in the last 5+ years)
Alex Riviere (He/Him)
Senior Vue Developer at Nexcor Technologies
https://alex.party
display:flex;
display:grid;
var(--custom-property);
@container
@layer
:has()
color-mix();
body {
color: #000000;
background-color: #ffffff;
}
.invert {
color: #ffffff;
background-color: #000000;
}
// _vars.scss
$color-ink: #000000;
$color-paper: #ffffff;
// _style.scss
body{
color: $color-ink;
background-color: $color-paper;
}
.invert{
color: $color-paper;
background-color: $color-ink;
}
:root{
--color-ink: #000000;
--color-paper: #ffffff;
}
body{
color: var(--color-ink);
background-color: var(--color-paper);
}
.invert{
color: var(--color-paper);
background-color: var(--color-ink);
}
Bonus round?
(Bonus Round)
@property --my-color{
syntax: "<color>";
inherits: true;
initial-value: black;
}
p{
color: var(--my-color);
}
(Credit: Miriam Suzanne)
(Credit: Jen Simmons)
A Common Problem
.input-wrapper:has(input:invalid)
<div class="input-wrapper">
<input type="email" value="alex" />
</div>
:has()
This:has(a.solution)
.blue-box{
display:grid;
grid-template-columns: 1fr;
}
@media screen and (min-width: 450px) and (max-width: 1023px){
.blue-box{
grid-template-columns: 1fr 1fr;
}
}
@media screen and (min-width: 1024px) and (max-width: 1439px){
.blue-box{
grid-template-columns: 1fr;
}
}
@media screen and (min-width: 1440px){
.blue-box{
grid-template-columns: 1fr 1fr;
}
}
.blue-box-wrapper{
container-type: inline-size;
container-name: blue-box;
}
.blue-box{
display:grid;
grid-template-columns: 1fr;
}
@container blue-box (min-width: 450px) {
.blue-box {
grid-template-columns: 1fr 1fr;
}
}
.text-red{
color:red;
}
.my-class{
color:blue;
}
.text-red{
color:red !important;
}
.my-class{
color:blue;
}
.my-class{
color:blue;
}
.text-red{
color:red;
}
.my-wrapper .my-class{
color:blue;
}
.text-red{
color:red;
}
@layer style, utility;
@layer style {
.my-wrapper .my-class{
color:blue;
}
}
@layer utility{
.text-red{
color:red;
}
}
@layer style, utility;
@layer utility{
.text-red{
color:red;
}
}
@layer style {
.my-wrapper .my-class{
color:blue;
}
}
@layer framework, style, utility;
@import url('framework.css') layer(framework);
@layer utility{
.text-red{
color:red;
}
}
@layer style {
.my-wrapper .my-class{
color:blue;
}
}
/* in scss */
$primary: #639;
$primary-hover: lighten($primary, 25%);
body{
background-color: $primary;
}
body:hover{
background-color: $primary-hover;
}
/* compiled CSS */
body {
background-color: #639;
}
body:hover {
background-color: #a679d2;
}
:root{
--c-primary: #639;
--c-primary-hover: hsl(from var(--c-primary) h s calc(l + 25));
}
body{
background-color: var(--c-primary);
}
body:hover{
background-color: var(--c-primary-hover);
}
sin()
cos()
tan()
asin()
acos()
atan()
atan2()
/* before.... */
.wrapper .title{
/* styles */
}
.wrapper .content{
/* styles */
}
.wrapper .actions{
/* styles */
}
/* after.... */
.wrapper {
.title{
/* styles */
}
.content{
/* styles */
}
.actions{
/* styles */
}
}
Jon Neal - For making an app that says the date when features were added to the browser
Alex Riviere
CodePens:
min() Example
max() Example
clamp() Example
Alex Riviere
CodePens:
<style>
p{
color:red;
}
</style>
<p>This is red text!</p>
<style>
p{ color:red; }
</style>
<p>This is red text!</p>
<div>
<style>
@scope{
p{ color: blue; }
}
</style>
<p>
This text is blue!
</p>
</div>
*Available in Safari Technical Preview
Alex Riviere
CodePens: