简单教程
提交运行
代码编辑器:
<style> #myDIV {text-align: justify; } </style> <div id="myDIV"> You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. </div> <p>点击“尝试一下”按钮,改变 DIV 元素的 text-align-last 属性</p> <button onclick="myFunction()">尝试一下</button> <script> function myFunction(){ document.getElementById("myDIV").style.textAlignLast = "right"; document.getElementById("myDIV").style.MozTextAlignLast = "right"; // 针对 Firefox 的代码 } </script> <p><b>注意:</b>目前只有 Internet Explorer 支持 textAlignLast 属性</p> <p><b>注意:</b>Firefox 支持另一个可替代该属性的属性,即 MozTextAlignLast 属性</p>
运行结果: