多此一举。看个小例子。 Sets or retrieves a value that indicates whether to render ellipses(...) to indicate text overflow.SyntaxHTML { text-overflow : iTextOverflow } Scripting object.style.textOverflow(v) [ = iTextOverflow ] Possible ValuesiTextOverflow Variant that specifies or receives a value that indicates whether ellipses(...) display when text content has overflowed its given layout area.ellipsis Display ellipses(...) for text overflow. clip Default. Simply clip the content and do not display ellipses for text overflow.
<DIV STYLE="position: relative; height: 75px; top:10"> <DIV STYLE="position: absolute; left: 10px; font: bold 16px Arial, sans-serif; color: blue; "> STYLE ="text-overflow : clip; overflow : hidden" <DIV STYLE="position: absolute; left: 0px; top: 18px; color: black; width: 120px; height: 50px; border: 1px solid blue; font: 14px Times New Roman, serif; overflow: hidden; text-overflow:clip"> <NOBR>We hold these truths to be self-evident, that all people are created equal.</NOBR> </DIV> </DIV><DIV STYLE="position: relative; height: 75px; top: 70"> <DIV STYLE="position: absolute; left: 10px; font: bold 16px Arial, sans-serif; color: blue; "> STYLE ="text-overflow : ellipsis; overflow : hidden" <DIV STYLE="position: absolute; left: 0px; top: 18px; color: black; width: 120px; height: 50px; border: 1px solid blue; font: 14px Times New Roman, serif; overflow: hidden; text-overflow:ellipsis"> <NOBR>We hold these truths to be self-evident, that all people are created equal.</NOBR> </DIV> </DIV><DIV STYLE="position: relative; height: 75px; top:70"> <DIV STYLE="position: absolute; left: 10px; font: bold 16px Arial, sans-serif; color: blue; "> STYLE ="text-overflow : ellipsis; overflow : visible" <DIV STYLE="position: absolute; left: 0px; top: 18px; color: black; width: 120px; height: 50px; border: 1px solid blue; font: 14px Times New Roman, serif; overflow: visible; text-overflow:ellipsis"> <NOBR>We hold these truths to be self-evident, that all people are created equal.</NOBR> </DIV> </DIV>
STYLE ="text-overflow : ellipsis; overflow : hidden" We hold these truths to be self-evident, that all people are created equal. ellipsis这个值就可以做到
<asp:Label runat="server" Text='<%# GetValue(((DataRowView)Container.DataItem)["TITLE"].ToString()) %>' ID="Label4">
.cs
protected string GetValue(string content)
{
if(content.Length>47)
{
content = content.Remove(47,content.Length-47)+"...";
} return content;
}
Sets or retrieves a value that indicates whether to render ellipses(...) to indicate text overflow.SyntaxHTML { text-overflow : iTextOverflow }
Scripting object.style.textOverflow(v) [ = iTextOverflow ] Possible ValuesiTextOverflow Variant that specifies or receives a value that indicates whether ellipses(...) display when text content has overflowed its given layout area.ellipsis Display ellipses(...) for text overflow.
clip Default. Simply clip the content and do not display ellipses for text overflow.
<DIV STYLE="position: relative; height: 75px; top:10">
<DIV STYLE="position: absolute; left: 10px;
font: bold 16px Arial, sans-serif; color: blue; ">
STYLE ="text-overflow : clip; overflow : hidden"
<DIV STYLE="position: absolute; left: 0px; top: 18px; color: black;
width: 120px; height: 50px; border: 1px solid blue;
font: 14px Times New Roman, serif; overflow: hidden;
text-overflow:clip">
<NOBR>We hold these truths to be self-evident,
that all people are created equal.</NOBR>
</DIV>
</DIV><DIV STYLE="position: relative; height: 75px; top: 70">
<DIV STYLE="position: absolute; left: 10px;
font: bold 16px Arial, sans-serif; color: blue; ">
STYLE ="text-overflow : ellipsis; overflow : hidden"
<DIV STYLE="position: absolute; left: 0px; top: 18px; color: black;
width: 120px; height: 50px; border: 1px solid blue;
font: 14px Times New Roman, serif; overflow: hidden;
text-overflow:ellipsis">
<NOBR>We hold these truths to be self-evident,
that all people are created equal.</NOBR>
</DIV>
</DIV><DIV STYLE="position: relative; height: 75px; top:70">
<DIV STYLE="position: absolute; left: 10px;
font: bold 16px Arial, sans-serif; color: blue; ">
STYLE ="text-overflow : ellipsis; overflow : visible"
<DIV STYLE="position: absolute; left: 0px; top: 18px; color: black;
width: 120px; height: 50px; border: 1px solid blue;
font: 14px Times New Roman, serif; overflow: visible;
text-overflow:ellipsis">
<NOBR>We hold these truths to be self-evident,
that all people are created equal.</NOBR>
</DIV>
</DIV>