Click here to Skip to main content
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 22: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></ul>
 
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 BillWoodruff 260
1 Afzaal Ahmad Zeeshan 252
2 OriginalGriff 251
3 Mathew Soji 234
4 Maciej Los 230
0 OriginalGriff 6,419
1 Sergey Alexandrovich Kryukov 6,008
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,070


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2014
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