如何在javascript或css中弹性char长度?

Hai*_* IT -1 javascript css

我有一个样本

<h3>How to elasticity of the char length in javascript or css<h3>
<h3>How to elasticity<h3>
Run Code Online (Sandbox Code Playgroud)

如果字符串很长,如何配置字符串的大小

<h3>How to elasticity of ...<h3>
<h3>How to elasticity<h3>
Run Code Online (Sandbox Code Playgroud)

怎么样这个想法

Nie*_*sol 5

h3 {
    width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* magic happens here */
}
Run Code Online (Sandbox Code Playgroud)