1.单行显示(以h1为例)
代码:
< !DOCTYPE html>
< html lang=“en”>
< head>
< meta charset=“UTF-8”>
< meta name=“viewport” content=“width=device-width, initial-scale=1.0”>
< title>Document< /title>
< style>
h1 {
background: red;
max-width: 800px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
< /style>
< /head>
< body>
< div class=“right”>
< h1>vghhsbaygdxsajxhjsaxhsgtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< /h1>
< /div>
< /div>
< /body>
< /html>
结果: