运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> #myDIV { text-decoration: underline; text-underline-position: auto; } </style> </head> <body> <h1>Change text-underline-position with JavaScript</h1> <div id="myDIV"> C<sub>6</sub>H<sub>12</sub>O<sub>16</sub> (glucose). </div> <p>Click the "Try it" button to change the text-underline-position of the div.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("myDIV").style.textUnderlinePosition = "under"; } </script> </body> </html>