How to truncate getting anchor tag text in HTML table
P粉547170972
P粉547170972 2023-08-16 12:24:24
0
1
425

I'm trying to truncate text within the anchor text of an element. I added overflow: hidden; text-overflow: ellipsis; in the style of my anchor tag, but it still wraps.这里有一些可以复现的HTML:


   Test Test 123 
  
Column A Column B
Entry A ABC123ABC-ABC123ABC`


It doesn't seem to like the 50px width on the anchor tag text, I think it's the column width that's messing with it.

P粉547170972
P粉547170972

reply all (1)
P粉099145710

If you don’t want to wrap, you can addwhite-space:nowrap;
If you want to setwidth, set it to50pxinstead of50 px(no spaces allowed);
If you wantwidthto take effect, set yourto a block-level element, e.g. usingdisplay:inline-block

Here is the code:

  Test Test 123 
  
Column A Column B
Entry A ABC123ABC-ABC123ABC`
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!