在html输入中保留初始空白

在html输入中保留初始空白,html,formatting,Html,Formatting,我读了好几个答案,没有一个能解决我的问题。 我有一个html输入字段,预填充值为“.”(五个空格,两个句点) 当这显示在屏幕上时,前导空格被压缩,输入显示“.”。我在样式属性中设置了“空白:pre;”,但这并不能解决问题 <input type="text" name="field_53_13" id="field_53_13" class="h3270-input" style="width:51.309998px; height: 15px; white-space: pr

我读了好几个答案,没有一个能解决我的问题。 我有一个html输入字段,预填充值为“.”(五个空格,两个句点)

当这显示在屏幕上时,前导空格被压缩,输入显示“.”。我在样式属性中设置了“空白:pre;”,但这并不能解决问题

<input type="text" name="field_53_13" id="field_53_13" 
  class="h3270-input" 
  style="width:51.309998px; height: 15px; white-space: pre;" 
  value=".." maxlength="7" size="7">

试试

<input type="text" name="field_53_13" id="field_53_13" 
  class="h3270-input" 
  style="width:51.309998px; height: 15px; white-space: pre;" 
  value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.." maxlength="7" size="7">


无中断空间( ):

将为您节省。。。见下文。。。