CSS text.overflow with@Html.LabelFor
当我的bootstrap div列太小时,我想在@Html.LabelFor的末尾插入省略号 如果我使用静态文本,它会正确显示 洛雷姆ips 显示,但只要我使用@Html.LabelFor,它就会像 洛雷姆ips 没有。。。最后 随函附上我的密码:-CSS text.overflow with@Html.LabelFor,html,css,asp.net-mvc,twitter-bootstrap,Html,Css,Asp.net Mvc,Twitter Bootstrap,当我的bootstrap div列太小时,我想在@Html.LabelFor的末尾插入省略号 如果我使用静态文本,它会正确显示 洛雷姆ips 显示,但只要我使用@Html.LabelFor,它就会像 洛雷姆ips 没有。。。最后 随函附上我的密码:- <style> .hideOverflow { text-overflow: ellipsis; overflow: hidden; whi
<style>
.hideOverflow {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: inline-block;
}
</style>
<div class="row">
<div class="col-md-1 hideOverflow">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
@* @Html.LabelFor(model => model.Balloon)*@
</div>
<div class="col-md-4">
@Html.EditorFor(model => model.Balloon)
@Html.ValidationMessageFor(model => model.Balloon)
</div>
</div>
.隐藏溢出{
文本溢出:省略号;
溢出:隐藏;
空白:nowrap;
显示:内联块;
}
Lorem ipsum dolor sit amet,是一位杰出的献身者。
@*@Html.LabelFor(model=>model.Balloon)*@
@EditorFor(model=>model.Balloon)
@Html.ValidationMessageFor(model=>model.Balloon)
任何帮助都将不胜感激。
@Html.LabelFor
将被呈现为
您应该为
编写css,而不是为div
像下面这样的
.hideOverflow label{
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: inline-block;
}