我有一个asp.net Web应用程序。在视图中我有这个问题:我需要调整元素.node
我想在其中显示节点的内容。如果字符数很大,我只想显示节点内的字符,并删除节点外显示的其他字符。
<style
.node{
}
</style>
那么如何修改类node
的样式来完成这项任务呢?
答案 0 :(得分:1)
你可以尝试
.node{
overflow: hidden;
}
或
.node{
text-overflow:ellipsis;
}
答案 1 :(得分:1)
答案 2 :(得分:0)
在计算节点内容的长度后,在html中使用内联样式。
<%
//in your script
//get length of the node's label
//set a variable with specific style / class
%>
<div class="node" style="<% the specific style %>"><% //content %></div>
甚至使用不同的班级......
<div class="<% the specific by size class %>"><% //content %></div>