Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 按CSS中的行数限制文本_Html_Css - Fatal编程技术网

Html 按CSS中的行数限制文本

Html 按CSS中的行数限制文本,html,css,Html,Css,我有一个文本区域框,它回显“bio”-“bio”是我数据库中的文本内容 在这个文本区域旁边还有一个css框,我想知道如何将文本限制为三行,然后在css框下面继续 这是一张图表: _ _ _ _ _ _ _ _ _ _ | | Bio Content Goes Here | | blah, blah, blah, blah - - - - - - - - - - blah, blah, blah, blah

我有一个文本区域框,它回显“bio”-“bio”是我数据库中的文本内容

在这个文本区域旁边还有一个css框,我想知道如何将文本限制为三行,然后在
css
框下面继续

这是一张图表:

_ _ _ _ _ _ _ _ _ _
|                  |   Bio Content Goes Here
|                  |   blah, blah, blah, blah     
- - - - - - - - - -    blah, blah, blah, blah  
Content carrys on here, here, here and here etc.
Content carrys on here, here, here and here etc.
你可以试试这个:

.yourBox {
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: X;
    max-height: X*N
}

@media (-webkit-min-device-pixel-ratio: 0) {
    .yourBox {
        display: -webkit-box;
        -webkit-line-clamp: N; /* number of lines to show */
        -webkit-box-orient: vertical;
    }
}

重复问题:

这与php/mysql无关,一切都与CSS有关。@Daedalus不太好,因为这里的人可能会建议最好的方法是使用php脚本,例如:完全正确。只需控制框的大小,它的溢出隐藏。如果您特别希望计算“行”,则需要执行一些正则表达式,但可能仍然很棘手。@JamesPale限制字符串不会得到您的“行”数。它只会残忍地切断你的文字,甚至不计算行数。它还取决于客户端浏览器上的字体设置,确切地说是哪种字体用于显示等等。如果没有大量的客户机参与,您无法在服务器上可靠地完成这项工作。css与溢出:隐藏是你最好的选择。我们可以修改它添加。。。它何时删除额外的行?