我有包含九列的 WEBGRID
,在此我需要 text-align Right
用于 Money 字段和 text-align center
其他字段。当我尝试对齐列时,它已对齐,而 header
未正确对齐,如何根据列对齐对齐特定 Column
的标题。
<div id="gridContent">
@grid.GetHtml(
tableStyle: "webgrid-table",
headerStyle: "webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
selectedRowStyle: "webgrid-selected-row",
rowStyle: "webgrid-row-style",
columns: grid.Columns(
grid.Column("Cust_Name", "Customer Name", style:"Custname"),
grid.Column("SalesDatestr", "Sales Date",style: "name"),
grid.Column("TotalAmount", "Total Amount", style:"Curency"),
grid.Column("Pay_Amount", "Paid Amount", style:" width: 64px; text-align: right; margin-right: 174px; border-right-style: solid; border-right-width: 29px; "),
grid.Column("Pay_Mode", "Paid Mode", style: "name"),
grid.Column("Bank_Name", "Bank Name", style: "name"),
grid.Column("Bank_Address", "Bank Address", style: "name"),
grid.Column("ChequeNo", "ChequeNo", style: "name"),
grid.Column("Cheque_Datestr", "Cheque Date", style: "name")
)
)
</div>
风格:
Header
.webgrid-header td, th
{
background-color: #72AAD3; /*#D3D3D3; color: #6D70B5;*/
padding-bottom: 4px;
padding-top: 5px;
text-align: left;
border-bottom: 1px solid white;
border-top: 1px solid white;
margin-bottom: 2px;
padding: 0px 5px;
text-align: right;
height: 22px;
color: white;
font-weight: bold;
}
专栏
.Curency
{
text-align: right;
width: 80px;
border: rgba(250, 38, 38, 0);
border-right-style: solid;
border-right-width: 10px;
}
最佳答案
应用这个:
<style type="text/css">
tr.webgrid-row-style td:nth-child(4)
{
text-align: right;
}
</style>
关于html - 如何在 asp.net mvc 中对齐 Web 网格上的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20113994/