Javascript div元素的固定大小
我试图在html中创建一个大小固定的div元素。我的问题是,上面的div从主干接收输入文本。文本的大小未知,因此每次传输的文本较大时,div的大小都会自动改变。如何仅显示符合div预定义边界框的文本的第一个单词 我的css代码Javascript div元素的固定大小,javascript,html,Javascript,Html,我试图在html中创建一个大小固定的div元素。我的问题是,上面的div从主干接收输入文本。文本的大小未知,因此每次传输的文本较大时,div的大小都会自动改变。如何仅显示符合div预定义边界框的文本的第一个单词 我的css代码 .hashTagsCloud { max-width: 500px; max-height: 400px; overflow: hidden; } 和html代码: <div class= "hashTagsCloud span
.hashTagsCloud {
max-width: 500px;
max-height: 400px;
overflow: hidden;
}
和html代码:
<div class= "hashTagsCloud span4 offset1 "> //bootstrap
<div id="profiles> //backbone view
<script id="profileTemplate" type="text/template">//backbone template
</script>
</div>
</div>
//引导
在Div元素的CSS中,可以使用
overflow: hidden
在Div元素的CSS中,可以使用
overflow: hidden
在Div元素的CSS中,可以使用
overflow: hidden
在Div元素的CSS中,可以使用
overflow: hidden
您可以从此文本溢出中使用:省略号,选中您可以从此文本溢出中使用的:省略号,选中您可以从此文本溢出中使用的:省略号,选中您可以从此文本溢出中使用的:省略号代码>的css,选中您可以使用溢出:隐藏代码>属性,假定您已经在div上设置了宽度和高度
<style type='text/css'>
.text {
width: 100px;
height: 18px;
overflow: hidden;
white-space: pre-line; /* breaks up the text on spaces before hiding */
}
</style>
<div class='text'>some really really really long text</div>
.text{
宽度:100px;
高度:18px;
溢出:隐藏;
空白:行前;/*在隐藏前将文本拆分为空格*/
}
一些非常长的文本
您可以使用溢出:隐藏代码>属性,假定您已经在div上设置了宽度和高度
<style type='text/css'>
.text {
width: 100px;
height: 18px;
overflow: hidden;
white-space: pre-line; /* breaks up the text on spaces before hiding */
}
</style>
<div class='text'>some really really really long text</div>
.text{
宽度:100px;
高度:18px;
溢出:隐藏;
空白:行前;/*在隐藏前将文本拆分为空格*/
}
一些非常长的文本
您可以使用溢出:隐藏代码>属性,假定您已经在div上设置了宽度和高度
<style type='text/css'>
.text {
width: 100px;
height: 18px;
overflow: hidden;
white-space: pre-line; /* breaks up the text on spaces before hiding */
}
</style>
<div class='text'>some really really really long text</div>
.text{
宽度:100px;
高度:18px;
溢出:隐藏;
空白:行前;/*在隐藏前将文本拆分为空格*/
}
一些非常长的文本
您可以使用溢出:隐藏代码>属性,假定您已经在div上设置了宽度和高度
<style type='text/css'>
.text {
width: 100px;
height: 18px;
overflow: hidden;
white-space: pre-line; /* breaks up the text on spaces before hiding */
}
</style>
<div class='text'>some really really really long text</div>
.text{
宽度:100px;
高度:18px;
溢出:隐藏;
空白:行前;/*在隐藏前将文本拆分为空格*/
}
一些非常长的文本
您正在搜索高度、宽度和的组合吗?您正在搜索高度、宽度和吗?您正在搜索高度和宽度的组合吗,width
和?在我的div中,我得到了高度400px,因此它适合几行文字。我想要空白:nowrap;只出现在我的div底部的高度中。在我的div中,我得到了高度400px,因此它适合几行文字。我想要空白:nowrap;只出现在我的div底部的高度中。在我的div中,我得到了高度400px,因此它适合几行文字。我想要空白:nowrap;只出现在我的div底部的高度中。在我的div中,我得到了高度400px,因此它适合几行文字。我想要空白:nowrap;只出现在我的div底部的高度。