dynamically changing the size of font size based on text length using css and html

前端 未结 8 1233

I need to display user entered text into a fixed size div. What i want is for the font size to be automatically adjusted so that the text fills the box as much as possible.<

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 04:49

    
    
    
        
        Document
        
        
        
    
    
        
    I need to display user entered text into a fixed size div. What i want is for the font size to be automatically adjusted so that the text fills the box as much as possible. I'd probably want to start with a maximum font size and while the text is too big to fit the container, shrink the font size until it fits and the font must be displayed as a single line. Is it possible to do this using only css and html.

提交回复
热议问题