* Add autoscoping with generated demo * Remove manual demo from all snippets * Add JavaScript inside IIFE * Align mouse-cursor-gradient-tracking.md to demo code * Match snippets to demo * Update CONTRIBUTING.md * Create reusable function for code extraction
1.2 KiB
1.2 KiB
System font stack
Uses the native font of the operating system to get close to a native app feel.
HTML
<p class="system-font-stack">This text uses the system font.</p>
CSS
.system-font-stack {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu,
Cantarell, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
Demo
Explanation
The browser looks for each successive font, preferring the first one if possible, and falls back to the next if it cannot find the font (on the system or defined in CSS).
-apple-systemis San Francisco, used on iOS and macOS (not Chrome however)BlinkMacSystemFontis San Francisco, used on macOS ChromeSegoe UIis used on Windows 10Robotois used on AndroidOxygen-Sansis used on GNU+LinuxUbuntuis used on Linux"Helvetica Neue"andHelveticais used on macOS 10.10 and below (wrapped in quotes because it has a space)Arialis a font widely supported by all operating systemssans-serifis the fallback sans-serif font if none of the other fonts are supported
Browser support
✅ No caveats.