html - 使旋转文本占据父级的整个高度
问题描述
嘿,我只是在搞乱一些 css 转换,我无法做到这一点,
https://codepen.io/simobm/pen/YvoOMO
我使用 Bootstrap 4,所以我制作了 2 列,左侧有一个图像,右侧有一些文本,现在我希望文本垂直居中,所以我使用:
transform:rotate(90deg)
在文本和:
align-items: center;
text-align: center;
关于列本身。如您所见,问题是在移动设备上,文本连续分成 2 行和 3 行。
解决方案
您可以应用一个方便的text-nowrap
类来阻止文本变为多行。
<div class="container">
<div class="row mt-5">
<div class="col-9 ">
<img class="img-fluid" src="https://images.unsplash.com/photo-1521818372696-23e67aff37a5?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=b42f31aba73642725afa0a222d211542" alt="">
</div>
<div class="col-3 d-flex align-items-center justify-content-center">
<p class="rotate text-nowrap">Azurmendi by ENEKO ATXA</p>
</div>
</div>
</div>
如果不处理文本大小调整,这可能会对移动设备产生一些潜在的不良影响。
有用的链接
推荐阅读
- c++ - 没有匹配的成员函数调用“push_back”错误
- git - Visual Studio Code 中的 Git - 推送到不使用上下文菜单
- mongodb - 如何处理 PyMongo/MongoEngine 自动重新连接?
- android - 如何在包含宽度为“0dp”的视图的约束布局中将打包链居中?
- python - 更新人脸识别模型中的新数据
- mysql - Grafana 与 MySQL:不支持此身份验证插件
- android - 我可以将 firebase 聊天集成到使用 mysql 数据库进行用户登录的应用程序中吗?
- javascript - Jekyll 站点 html 表单提交到不同的页面但重定向到另一个
- python - Keras LSTM 中隐藏状态的含义
- php - laravel eloquent:Eloquent 关系需要在没有数据的时候返回一些东西,而不是返回 null 对象