Javascript 在元素中显示多个字符

Javascript 在元素中显示多个字符,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一个asp.net web应用程序。在视图中,我遇到了这个问题:我需要调整元素.node 我想在其中显示节点的内容。如果字符数很大,我想只显示节点内的字符,并删除节点外显示的其他字符 <style .node{ } </style> 您可以试试 .node{ overflow: hidden; } 或 你也可以试试 在计算节点内容的长度后,此属性在html中剪辑文本使用内联样式 <% //in your script //get length of t

我有一个asp.net web应用程序。在视图中,我遇到了这个问题:我需要调整元素
.node

我想在其中显示节点的内容。如果字符数很大,我想只显示节点内的字符,并删除节点外显示的其他字符

<style
.node{



}
</style>
您可以试试

.node{
  overflow: hidden;
}

你也可以试试


在计算节点内容的长度后,此属性在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>

.node{
text-overflow: clip; 
}
<%
//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>