Created
July 11, 2022 21:41
-
-
Save nolanlawson/7270a4e13a805897ac6719dd337259e6 to your computer and use it in GitHub Desktop.
Test @font-face in shadow DOM
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
<!doctype html> | |
<html> | |
<head> | |
<title>Test @font-face in shadow DOM</title> | |
</head> | |
<body> | |
<h1>Test @font-face in shadow DOM</h1> | |
<div></div> | |
<script> | |
document.querySelector('div') | |
.attachShadow({ mode: 'open' }) | |
.innerHTML = ` | |
<style> | |
@font-face { | |
font-family: Custom; | |
src: | |
local("Courier New"), | |
local("CourierNew"), | |
local("Courier"); | |
} | |
.custom { | |
font-family: Custom; | |
} | |
</style> | |
<div class="custom"> | |
I should be Courier | |
</div> | |
` | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment