Last active
October 5, 2024 22:27
-
-
Save jensgro/7a8f76f8deb6072a7af25a65dc9a0994 to your computer and use it in GitHub Desktop.
Ein Detail-Asprekt der Nutzung von Custom Properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ========= nicht so praktisch ========= */ | |
p { | |
font-size: var(--fs-xs); | |
} | |
@media (min-width: 800px) { | |
p { | |
font-size: var(--fs-sm); | |
} | |
} | |
/* ========= besser!!!! ========= */ | |
p { | |
font-size: var(--fz-para, var(--fs-xs)); | |
} | |
@media (min-width: 800px) { | |
p { | |
--fz-para: var(--fs-sm); | |
} | |
} | |
/* ========= oder auch ========= */ | |
:root { | |
--fs-xs: 0.85rem; | |
--fs-md: 1rem; | |
--fz-lg: 1.25rem; | |
} | |
p { | |
--_fz-para: var(--fs-xs); | |
font-size: var(--_fz-para); | |
} | |
@media (min-width: 800px) { | |
p { | |
--_fz-para: var(--fs-sm); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment