Also ich habe eine Liste von Objekten basierend auf der Tabellenansicht in Aspmvc und integriert .. es sieht so aus. So zentrieren Sie Asp MVC-Tabellenobjekte?
Problem ist, möchte ich alle Elemente in der Mitte ausgerichtet sein. Der Code ist ziemlich generisch, wörtlich der generierte Code, den ich glaube.
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.m_EmailAddress)
</th>
<th>
@Html.DisplayNameFor(model => model.m_FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.m_LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CellNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyName)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyAddress)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyState)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyZip)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyPhone)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyWebsite)
</th>
<th>
@Html.DisplayNameFor(model => model.m_WorkTravelRange)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyCostCode)
</th>
<th>
@Html.DisplayNameFor(model => model.m_CompanyAccountType)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.m_EmailAddress)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CellNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyName)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyAddress)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyState)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyZip)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyPhone)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyWebsite)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_WorkTravelRange)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyCostCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.m_CompanyAccountType)
</td>
@*<td>
@Html.ActionLink("Edit", "Edit", new { id=item.m_IdentityCode }) |
@Html.ActionLink("Details", "Details", new { id=item.m_IdentityCode }) |
@Html.ActionLink("Delete", "Delete", new { id=item.m_IdentityCode })
</td>*@
Mein Instinkt sagt mir ..
<table class = "table" align = "center">
Aber in Anspruch nehmen.
Kann mir jemand in die richtige Richtung zeigen? Bitte und Danke.
Edit:
Ich versuchte <th text-align: center>
aber es sieht immer noch links ausgerichtet.
Stil verweist Sie 'th' und' td' Elemente mit 'text-align: center' –
@StephenMuecke Danke , Herr. – Eidenai
@StephenMuecke Ich habe die Frage aktualisiert, schaut immer noch linksbündig aus. – Eidenai