从右侧填充css/javascript输入字段
我怎样才能有一个HTML输入字段,它将接受数字,格式是从右边填充的,就像在Libre Office Calc中一样?(或excell)使用内联样式:从右侧填充css/javascript输入字段,javascript,html,css,Javascript,Html,Css,我怎样才能有一个HTML输入字段,它将接受数字,格式是从右边填充的,就像在Libre Office Calc中一样?(或excell)使用内联样式: <input type="text" style="text-align: right"/> 或者,将其放入样式表中,如下所示: <style> .rightJustified { text-align: right; } </style> .正确的{ 文本对齐:右对齐; } 并引
<input type="text" style="text-align: right"/>
或者,将其放入样式表中,如下所示:
<style>
.rightJustified {
text-align: right;
}
</style>
.正确的{
文本对齐:右对齐;
}
并引用该类:
<input type="text" class="rightJustified"/>
HTML:
CSS:
<input type="text" class="rightJustified"/>
input[type=number]{
direction:rtl;
}