fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <style> #myDIV{ width:150px; height:100px; background-color:lightblue; border:1px solid black; } </style> </head> <body> <p>点击“尝试一下”按钮。让 DIV 元素中的长单词换行到下一行:</p> <div id="myDIV">Thiscouldbeaninsainlylargeword</div> <button onclick="myFunction()">尝试一下</button> <script> function myFunction(){ document.getElementById("myDIV").style.wordWrap = "break-word"; } </script> </body> </html>
运行结果