Fit text perfectly inside a div (height and width) without affecting the size of the div

前端 未结 9 1854
盖世英雄少女心
盖世英雄少女心 2020-12-02 17:07

I apologise in advance as I know this question has come up many times before but I just can\'t seem to find the right solution (and believe me I\'ve tried a few!)

Ba

9条回答
  •  天涯浪人
    2020-12-02 17:50

    I was wanting something similar myself recently:

    This text won't be resized and will go out of the div.
    This text will be resized and wont go out of the div.

    And

    .no-resize, .resize {
        width: 100px;
        height: 50px;
        border: 1px solid #000;
        color: #000;
        float: left;
        margin-left: 10px;
        font-size: 15px
    }
    

    Fiddler at jsfiddle.net/mn4rr/1/.

提交回复
热议问题