style-first-letter-pseudo-ref.html (631B)
1 <!DOCTYPE html> 2 <html> 3 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 4 <style> 5 div { 6 color: rgb(0, 255, 0); 7 line-height: 2px; 8 } 9 10 div::first-letter { 11 color: rgb(255, 0, 0); 12 } 13 canvas{ 14 position: absolute; 15 top: 4px; 16 z-index: -1; 17 } 18 </style> 19 <body style="font: 10px/1 Ahem;"> 20 <div><canvas width="10px" height="10px"></canvas>ppp</div> 21 <script> 22 document.addEventListener('DOMContentLoaded', function() { 23 var canvas = document.querySelector('canvas'); 24 var context = canvas.getContext("2d"); 25 context.fillStyle = 'green'; 26 context.fillRect(0, 0, 10, 10); 27 }); 28 </script> 29 </body> 30 </html>