Insert ellipsis (…) into HTML tag if content too wide

后端 未结 24 3023
名媛妹妹
名媛妹妹 2020-11-22 10:07

I have a webpage with an elastic layout that changes its width if the browser window is resized.

In this layout there are headlines (h2) that will have

24条回答
  •  天涯浪人
    2020-11-22 10:47

    I'd done something similar for a client recently. Here's a version of what I did for them (example tested in all latest browser versions on Win Vista). Not perfect all around the board, but could be tweaked pretty easily.

    Demo: http://enobrev.info/ellipsis/

    Code:

    
        
            
            
    
            
        
        
            

    This is some really long text. This is some really long text. This is some really long text. This is some really long text.

提交回复
热议问题