惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 热门话题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
WordPress大学
WordPress大学
Project Zero
Project Zero
P
Palo Alto Networks Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
T
Tailwind CSS Blog
Forbes - Security
Forbes - Security
F
Full Disclosure
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
O
OpenAI News
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
IT之家
IT之家
U
Unit 42
腾讯CDC
S
Security Affairs
C
Cisco Blogs
Schneier on Security
Schneier on Security
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss

博客园 - smile轉角

【js】ES5,ES6继承是如何实现的 【js】setTimeout、Promise、Async/Await 的区别 【面试题】思维逻辑方面 【js】js内置对象Error(错误机制) 【TS】学习笔记 【js】CommonJS、AMD、CMD三种规范 【其他】查看Animate.css官网动画没有效果 【vue3】父子组件通信之 vue3 defineProps,defineEmits ,defineExpose 【js】JS严格模式有什么特点 【vue】 Failed to load resource: the server responded with a status of 404 (Not Found) 【第三方】富文本调研 【js】元素是否在可视区范围内 【js】json的相关操作 【vue3】资料 【css】展示背景图片的底部部分 【html】 svg 【html5】html5中input 标签 type值为range时,修改其默认css 【js】forEach,for...in,for...of 区别 【js】map,reduce,filter的区别
【css】使用弹性盒子布局时,省略号问题
smile轉角 · 2023-01-12 · via 博客园 - smile轉角

栗子:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹性盒子省略号问题</title>

    <style>
        *{
            margin: 0;
            padding: 0;
        }
  
.ui-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } .ui-flex-1 { -webkit-box-flex: 1; -webkit-flex: 1; -ms-flex: 1; flex: 1; } .ui-flex-basis{ flex: 1 0 0; } .ut-s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ut-s-line{ display: -webkit-box; /**对象作为伸缩盒子模型展示**/ -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/ -webkit-line-clamp: 1; /**显示的行数**/ overflow: hidden; /**隐藏超出的内容**/ text-overflow: ellipsis; white-space: normal; word-break: break-all; /*允许在单词内换行*/ } .ut-s-line2{ display: -webkit-box; /**对象作为伸缩盒子模型展示**/ -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/ -webkit-line-clamp: 2; /**显示的行数**/ overflow: hidden; /**隐藏超出的内容**/ text-overflow: ellipsis; white-space: normal; word-break: break-all; /*允许在单词内换行*/ } .main-container{ width:500px; margin: 0 auto; } .box{ border:1px solid red; padding:10px; } h6{ margin:20px; text-align: center; } .box-left{ width: 200px; height: 200px; border:1px solid #ccc; margin-right: 20px; } .box-right-bottom{ padding:10px 0; } .box-right-top{ } .box-right-title{ width:calc(100% - 222px ); } </style> </head> <body> <div class="main-container"> <h6>容器1(ui-flex容器内直接包裹内容,然后使用省略号的css代码即实现 )</h6> <div class="ui-flex box"> <div class="box-left"></div> <div class="box-right ui-flex-1 ut-s"> 我是标题我是表我是标题我是表我是标题我是表我是标题我是表 </div> </div> <h6>容器2</h6> <div class="ui-flex box"> <div class="box-left"></div> <div class="box-right ui-flex-1"> <div class="box-right-top ut-s">我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题</div> <div class="box-right-bottom"> 2023年1月12日</div> </div> </div> <h6>容器3(对象作为伸缩盒子模型展示 display:box)</h6> <div class="ui-flex box"> <div class="box-left"></div> <div class="box-right ui-flex-1"> <div class="box-right-top ut-s-line">我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题</div> <div class="box-right-bottom"> 2023年1月12日</div> </div> </div> <h6>容器4(指定弹性元素的宽度)</h6> <div class="ui-flex box"> <div class="box-left"></div> <div class="box-right ui-flex-1" style="width:calc(100% - 222px)"> <div class="box-right-top ut-s">我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题</div> <div class="box-right-bottom"> 2023年1月12日</div> </div> </div> </div> </body> </html>

效果:

 

 相关资料: