代码
提交代码
<style> .outer { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background:rgb(0, 0, 0); } .outer .text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 100px; text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #FF1177, 0 0 35px #FF1177, 0 0 40px #FF1177, 0 0 50px #FF1177, 0 0 75px #FF1177; } </style> <div class="outer"> <div class="text">100x200</div> </div> <script> var text = document.querySelector('.text'); var resize = function() { var height = window.innerHeight; var width = window.innerWidth; text.innerText = width + 'x' + height; }; window.addEventListener('resize', resize); resize(); </script>
运行结果