You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/css-layout/responsive.md
+28-14Lines changed: 28 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,26 +133,40 @@ body { font-size: 13px; }
133
133
Es gibt sogar mediaqueries für die Präferenz des "dark mode":
134
134
135
135
<csscaption="CSS Medaqueries für color-scheme">
136
-
@media (prefers-color-scheme: dark) {
137
-
body {
138
-
color: #ddd;
139
-
background-color: black;
140
-
}
141
-
h1,h2,h3 {
142
-
color: #d39060;
143
-
}
136
+
:root {
137
+
color-scheme: light dark;
144
138
}
145
139
146
140
@media (prefers-color-scheme: light) {
147
-
body {
148
-
color: #333333;
149
-
background-color: #ffffff;
141
+
.element {
142
+
color: black;
143
+
background-color: white;
150
144
}
151
-
h1,h2,h3 {
152
-
color: #333333;
145
+
}
146
+
147
+
@media (prefers-color-scheme: dark) {
148
+
.element {
149
+
color: white;
150
+
background-color: black;
153
151
}
154
152
}
155
153
</css>
156
154
157
-
siehe auch [MDN: media features](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#Media_features) und [MDN: features queries](https://developer.mozilla.org/en-US/docs/Web/CSS/@supports)
155
+
oder, seit 2024 noch kürzer:
156
+
157
+
<csscaption="light-dark Funktion für Farben">
158
+
:root {
159
+
color-scheme: light dark;
160
+
}
161
+
162
+
.element {
163
+
color: light-dark(black, white);
164
+
background-color: light-dark(white, black);
165
+
}
166
+
</css>
167
+
168
+
siehe auch
169
+
*[MDN: media features](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#Media_features)
170
+
*[MDN: features queries](https://developer.mozilla.org/en-US/docs/Web/CSS/@supports)
0 commit comments