Click here to Skip to main content
11,704,001 members (67,422 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET CSS HTML
like

i am displaying some Keywords in
  • <\li> <\ul>

    as the
    • having fixed with so if the keyword is long how can i manage with

      KEYWORDNAME = KEYWORDNAME..
Posted 10-Mar-13 21:32pm
sr_24484
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Add ellipsis style to li tag. It will automatically add .. after text if required otherwise show normal text.

<ul><li style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:20px">Add your text here to test</li>

Refer this link for help
http://stackoverflow.com/questions/9507555/css-text-overflow-ellipsis-causes-lis-number-to-dissapear
  Permalink  
v2
Comments
sr_24 at 11-Mar-13 5:53am
   
my Visual studio 2008 doesnot support css3 text-overflow:ellipsis ...can there be any alternative solution ?? in css2
pradiprenushe at 11-Mar-13 6:00am
   
Instead of creating class in css you can directly add style then you dont face css version issue.
sr_24 at 11-Mar-13 6:05am
   
thanks
pradiprenushe at 11-Mar-13 6:06am
   
welcome
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

string strText = "Pakistan is my Country";
           if (strText.Length > 10)
           {
               string abcText = strText.Substring(0, 8) + "..";
           }
  Permalink  
Comments
sr_24 at 11-Mar-13 6:04am
   
thanks Pakistan bhai ..i hv used it like this

for (int k = 0; k <= t; k++)
{
if (arr[k].Length > 15)
{
arr[k]= arr[k].Substring(0, 12) + " ..";
}

Display_Keywords.InnerHtml += "<li>"
+ "" + arr[k] + " "
+ "</li> ";
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 530
1 OriginalGriff 510
2 Sergey Alexandrovich Kryukov 421
3 Andy Lanng 294
4 F-ES Sitecore 220
0 OriginalGriff 8,744
1 Sergey Alexandrovich Kryukov 7,747
2 CPallini 5,107
3 Maciej Los 4,716
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100