Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一列数字来正确对齐。在'C'中: printf("\n %10d %10s"...)
这是如何在 JavaScript 中完成的?
如果您使用 JavaScript 在网页中打印数字,您将需要使用 CSS text-align 属性。
例如,如果你在 DOM 元素中写出数字列<div id='myNumbers'>,你可以写
<div id='myNumbers'>
document.getElementById('myNumbers').style.textAlign = 'right';