菜鸟学堂
在线运行
源代码
<!DOCTYPE html> <html> <body> <pre id="t1"> I have tabs inside! </pre> <p>点击“尝试一下”按钮,改变 PRE 元素的 tab-size 属性。</p> <button onclick="myFunction()">尝试一下</button> <script> function myFunction() { document.getElementById("t1").style.tabSize = "16"; document.getElementById("t1").style.MozTabSize = "16"; // 针对 Firefox 的代码 document.getElementById("t1").style.OTabSize = "16"; // 针对 Opera 的代码 } </script> <p><b>Note:</b> The tabSize property is currently only supported in Chrome.</p> <p><b>Note:</b> Firefox supports an alternative, the MozTabSize property.</p> <p><b>Note:</b> Opera supports an alternative, the OTabSize property.</p> </body> </html>
运行结果
在线运行
菜鸟学堂 edu.jb51.net