Font scaling based on width of container

后端 未结 30 3125
面向向阳花
面向向阳花 2020-11-21 04:35

I\'m having a hard time getting my head around font scaling.

I currently have a website with a body font-size of 100%. 100% of what though? This seems t

30条回答
  •  长情又很酷
    2020-11-21 05:24

    For dynamic text, this plugin is quite useful:

    http://freqdec.github.io/slabText/

    Simply add CSS:

    .slabtexted .slabtext
    {
        display: -moz-inline-box;
        display: inline-block;
        white-space: nowrap;
    }
    .slabtextinactive .slabtext
    {
        display: inline;
        white-space: normal;
        font-size: 1em !important;
        letter-spacing: inherit !important;
        word-spacing: inherit !important;
        *letter-spacing: normal !important;
        *word-spacing: normal !important;
    }
    .slabtextdone .slabtext
    {
        display: block;
    }
    

    And the script:

    $('#mydiv').slabText();
    

提交回复
热议问题