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

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

概述我有一个类似于下图的div结构.我需要应用“文本溢出:省略号”;在较小的窗口中在这个div结构中发短信.(图2)但它并没有像我预期的那样适用.这是我的HTML代码 .header { height: 60px; width: 100%; } .header > .header_middle { margin: 0 auto;

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

我需要应用“文本溢出:省略号”;在较小的窗口中在这个div结构中发短信.(图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/ 总结

以上是内存溢出为你收集整理的html – 将“text-overflow:ellipsis;”应用于内部div全部内容,希望文章能够帮你解决html – 将“text-overflow:ellipsis;”应用于内部div所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1118895.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)