html – 将“text-overflow:ellipsis;”应用于内部div

我有一个类似于下图的div结构.

image 1

我需要应用“文本溢出:省略号”;在较小的窗口中在这个div结构中发短信.(图2)

image 2

但它并没有像我预期的那样适用.这是我的HTML代码

    .header {
		height: 60px;
		width: 100%;
	}
	.header > .header_middle {
		margin: 0 auto;
		width: 100%;
	}
	.header > .header_middle.share-file-header > .caption {
		float: left !important;
		line-height: 60px;
		overflow: hidden;
		padding-right: 0 !important;
		text-overflow: ellipsis;
		white-space: Nowrap;
		padding: 0 30px;
	}
	.header > .header_middle.share-file-header .settings {
		line-height: inherit;
		padding: 0 15px 0 0;
		float: right;
		height: 60px;
		position: relative;
	}
	.shared-person-detail-wrapper {
		display: inline-block;
		overflow: hidden;
		text-overflow: ellipsis;
		line-height: inherit;
	}
	.settings .share-files-msg,.settings .shared-person {
		display: block;
		font-size: 14px;
		text-overflow: ellipsis;
	}
	.settings .more-persons-wraper {
		display: inline-block;
		position: relative;
	}
    

这段代码有什么问题,任何人都可以给我一个指南吗?谢谢

最佳答案
为了使元素具有溢出作为省略号,您需要在其上设置这些CSS规则:

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 60px; #(any width would do)

这是一个jsfiddle,我在.shared-person类中添加了这些.
https://jsfiddle.net/3dukmv5q/

相关文章

vue阻止冒泡事件 阻止点击事件的执行 <div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些