我是这样设的:<div style="width:100px; overflow: hidden;">
但是每一行的内容找装不下的不会隐藏,而是自动换行。
没有看到你的代码,好像dojo的dojoType这个属性可以设置 你试试看
可以设置div的大小,然后设置overflow属性为hidden,这样就会将超过的部分隐藏掉了。注意高度设为一个字宽。
如<div style="width:50px;height:1em;overflow:hidden;">
天行健,君子以自强不息!地势坤,君子以厚德载物。。。</div>
Mark下。
这个功能有什么具体的作用的吗?可以用在什么方面呢?望指导下,谢谢。
你没设置div的高度
在div中添加一个属性overflow:hidden
.box {
width: 100px;
overflow: hidden;
white-space: nowrap;
background:#039;
height:300px;
}
white-space: nowrap;这个保证元素不换行。