blob: 6f8a9378c5c2f041ae8be4bc0a4e22be8869a107 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<!doctype html>
<title>CSS Test: ::first-letter correctly applies background-image dynamically</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1528451">
<link rel="match" href="first-letter-background-image-ref.html">
<style>
div::first-letter {
color: lime;
}
div.image::first-letter {
/* Lime background */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M/wHwAEBgIApD5fRAAAAABJRU5ErkJggg==');
}
</style>
<div>
A letter
</div>
<script>
let div = document.querySelector("div");
getComputedStyle(div).color;
div.classList.add('image');
</script>
|