css - 将 h1 元素的宽度限制为其父元素
问题描述
我想限制高清的宽度,但不必设置宽度。我希望它占据整个可用宽度(父级的宽度?)
.wrapper {
outline: 1px #000 solid;
width: 600px;
margin: auto;
display: flex;
}
.left {
flex-grow: 1
}
.left h1 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}
.right {
width: 200px;
background-color: #CCC;
}
<div class="wrapper">
<div class="left">
<h1>this is a really really really long heading</h1>
</div>
<div class="right">right</div>
</div>
解决方案
推荐阅读
- c++ - QToolbar的句柄是什么类型的组件?
- php - 队列未处理
- python - 文档字符串中的 python 注释
- traffic - 在 istio 中,如果 iptables 只重定向出站流量,会发生什么?
- android - Xamarin 不会内存不足
- c++ - 使用 LuaBridge 将 LuaJIT 绑定到 C++ 会导致“PANIC: unprotected error”
- sql - PL/SQL 中的“使用”查询?
- linux - NASM x86_64 删除换行符并在字符串末尾添加 0
- javascript - 将整个表单 css 变灰
- c# - 从“System.String”到“Serilog.Core.IDestructuringPolicy”的无效转换