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

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

博客园 - 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>

效果:

 

 相关资料: