对于所有默认输入,您填写的文本从左侧开始。怎么让它从右边开始?


当前回答

@Html。TextBoxFor(model =>模型。IssueDate, new {@class = "form-control", name = "inv_issue_date", id = "inv_issue_date", title = "Select Invoice开票日期",placeholder = "dd/mm/yyyy", style = "text-align:center;"})

其他回答

没有CSS: 使用文本输入的STYLE属性

风格= " text-align:权利;"

以下方法可能对你有用:

<style>
   input {
         text-align: right !important; 
   }
   textarea{
        text-align:right !important;
   }
   label {
       float: right !important;
   }
</style>

引导5现在class="text-end":

<link href=“https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css” rel=“stylesheet” integrity=“sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC” crossorigin=“anonymous”> <input step=“any” id=“myInput” type=“number” class=“text-end”>

. 参考网址:https://getbootstrap.com/docs/5.0/utilities/text/#text-alignment

在CSS中使用text-align属性:

input { 
    text-align: right; 
}

这将在页面的所有输入中生效。 否则,如果你只想对齐一个输入的文本,设置样式为inline:

<input type="text" style="text-align:right;"/> 

@Html。TextBoxFor(model =>模型。IssueDate, new {@class = "form-control", name = "inv_issue_date", id = "inv_issue_date", title = "Select Invoice开票日期",placeholder = "dd/mm/yyyy", style = "text-align:center;"})