Modern CSS and compatibility
Adopting modern CSS features enable developers to:
.element {
display: flex;
gap: 1.25ch;
align-items: center;
}
Overskrift
Morbi tortor mi, semper id magna quis, auctor auctor purus. Nam pellentesque vulputate lectus, et euismod est tincidunt sed.
Overskrift
Overskrift
Overskrift
giraf
Figma: Vertical trim
h1 {
text-box-trim: trim-both;
text-box-edge: cap alphabetic;
}
h1 {
/*text-box-trim: trim-both;
text-box-edge: cap alphabetic;*/
text-box: cap alphabetic;
}
h1 {
text-box: trim-both cap alphabetic;
}
h1 {
text-box: trim-start cap alphabetic;
}
Prøv det selv
Overskrift
Morbi tortor mi, semper id magna quis, auctor auctor purus. Nam pellentesque vulputate lectus, et euismod est tincidunt sed.
/*article {
> * + * {
margin-top: 1rlh;
}
}*/
article {
margin-trim: block;
> * {
margin-block: 1rlh;
}
}
article {
padding: 2rlh;
gap: 1rlh;
}
h1,
h2,
h3 {
text-wrap: balance;
}
p {
text-wrap: pretty;
}
p:first-letter {
initial-letter: 3;
}
Mål: Vide, hvordan vi håndterer det
Strategier
.element {
background: #00d600;
background: oklch(70% 100% 150);
}
p {
text-wrap: pretty;
}
details {
interpolate-size: allow-keywords;
}
[open]::details-content {
block-size: calc-size(auto, size);
}
@view-transition {
navigation: auto;
}
p {
text-wrap: pretty;
}
form {
accent-color: #5000ca;
}
@view-transition {
navigation: auto;
}
details {
interpolate-size: allow-keywords;
}
[open]::details-content {
block-size: calc-size(auto, size);
}
h2 {
text-box: trim-both cap alphabetic;
@supports not (text-box-trim: trim-both) {
margin-top: calc(.5cap - .5lh);
}
}
@supports (view-timeline: --my-timeline) {
...
}
@supports selector(::details-content) {
}
@supports not (interpolate-size: allow-keywords) {
[open]::details-content {
height: 150px;
overflow-y: scroll;
}
}
<script src="https://flackr.github.io/scroll-timeline/dist/scroll-timeline.js"></script>
.element {
animation: --move linear both;
animation-timeline: view();
}
if (!CSS.supports('animation-timeline: scroll()')) {
// importer GSAP
Øvelse
Find branchen "details-accordion" på vores GitHub-repository