css - 如何按比例上下拉伸 CSS 网格项目?
问题描述
我想以某种方式显示标题
- 填充整个宽度,在每个字形之间应用相等的字母间距
- 减少到最大可用宽度,平均重叠每个字形
到目前为止,我最好的尝试是使用 CSS 网格,grid-template-columns: repeat(auto-fit, minmax(0, max-content));
如下justify-content: space-between;
所示:
h1 {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, max-content));
justify-content: space-between;
}
<h1>
<span>W</span><span>i</span><span>l</span><span>d</span><span> </span><span>S</span><span>p</span><span>a</span><span>c</span><span>e</span>
</h1>
虽然我的第一个要求在上述解决方案中匹配,但在缩小时,具有不同宽度的相邻字母(尤其是“W”和“i”可见)将首先重叠,然后是其他字母,如下所示:
有没有办法强制字形均匀/同时重叠(就像他们会使用 一样grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
)但同时保持每个字形的初始宽度?
解决方案
推荐阅读
- powerbuilder - 查询 Powerbuilder 以获取某些复选框并输入 text/singelineedit 以获取 showig 消息框
- c++ - 如何将 crc-32 修改为 crc-32/mpeg-2
- scala - Play 2.5.x 中是否有用于捕获请求和响应以进行自定义日志记录的插件?
- c# - .Net Core 2.1 是否支持 HTTP/2 请求?
- java - 动画完成后如何设置图像可见性
- reactjs - 使用 firebase-functions 部署基于反应的 SSR 应用程序时出错
- sapui5 - 标签未左对齐
- javascript - React - 映射数组对象并传递给 react-select 中的 options 属性
- laravel - Laravel php 单元测试在 Windows Docker 中需要很长时间
- ajax - 我可以从目前显示的模型弹出窗口中刷新表格吗