(AKA things you may have missed
in the last 5 years)
Alex Riviere
Senior Web Developer at Traina
https://alex.party
https://slides.com/fimion/that-conf-tx-2023/
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);
}
(Credit: Miriam Suzanne)
(Credit: Jen Simmons)
min() Example
max() Example
clamp() Example
.my-style{
margin:10px;
}
/* Is equivalent to... */
.my-style{
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
}
.my-style{
margin: 0 10px;
}
/* Is equivalent to... */
.my-style{
margin-top: 0;
margin-right: 10px;
margin-bottom: 0;
margin-left: 10px;
}
.my-style{
margin: 0 10px 10px;
}
/* Is equivalent to... */
.my-style{
margin-top: 0;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
}
.my-style{
margin: 2px 4px 6px 8px;
}
/* Is equivalent to... */
.my-style{
margin-top: 2px;
margin-right: 4px;
margin-bottom: 6px;
margin-left: 8px;
}
.my-style{
margin: 10px;
}
/* adds to... */
.my-style.extraaaaa{
margin-left: 20px;
margin-right: 20px;
}
.my-style{
margin: 10px;
}
/* adds to... */
.my-style.extraaaaa{
margin-inline: 20px;
}
.container a strong,
.container p strong,
.container button strong,
.container code strong,
.container section strong{
font-weight: 900;
}
.container :is(a, p, button, section) strong{
font-weight: 900;
}
nav.nav-bar ul li a.nav-link{
color:blue;
}
:is(#\!important, a.nav-link){
color:red;
}
body{
background-color: black;
}
:where(body){
background-color: white;
}
A Common Problem
.input-wrapper:has(input:invalid)
<div class="input-wrapper">
<input type="email" value="alex" />
</div>
:has()
This:has(a.solution)
.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;
}
}
.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;
}
}
Jon Neal - For making an app that says the date when features were added to the browser
https://slides.com/fimion/that-conf-tx-2023/
Alex Riviere
CodePens:
https://codepen.io/collection/aMZPPq