Html 在
我正在显示一个从数据库到视图的表Html 在,html,css,asp.net-mvc,Html,Css,Asp.net Mvc,我正在显示一个从数据库到视图的表 @model IEnumerable<test1.Models.Malfunction> @{ ViewBag.Title = "Malfunctions"; } <h2>Malfunctions</h2> <table id="customers" class="table table-bordered table-hover"> <thea
@model IEnumerable<test1.Models.Malfunction>
@{
ViewBag.Title = "Malfunctions";
}
<h2>Malfunctions</h2>
<table id="customers" class="table table-bordered table-hover">
<thead>
<tr>
<th>ID</th>
<th>Description</th>
<th>Date Reported</th>
<th>Customer</th>
<th>Movie</th>
</tr>
</thead>
<tbody>
@foreach (var malfunction in Model)
{
<tr>
<td>@malfunction.Id</td>
<td>@malfunction.ReportDescription</td>
<td>@malfunction.DateReported</td>
<td>@malfunction.Customer</td>
<td>@malfunction.Movie</td>
</tr>
}
</tbody>
</table>
此属性:
<td>@malfunction.ReportDescription</td>
可以包含大量文本,如果太长,将与行中的下一个属性重叠,即:
<td>@malfunction.DateReported</td>
我要做的是在达到单元格宽度后断开该行,这样它就不会与DateReported中的文本重叠。添加:
td {
word-break: break-all;
}
加:
您可以使用任何前端框架或标记在元素的下一行;要断行。@只需编写代码,将其添加到何处,不起作用您可以使用任何前端框架或标记在元素的下一行。使用单词break:break all;要断行。@只需编写代码,将其添加到何处,不起作用吗?在哪里添加,不会将其添加到CSS中。请参阅答案底部的链接。你可以看到它在工作。在哪里添加它,不会将其添加到CSS中。请参阅答案底部的链接。你可以看到它在工作。