css - 如何阻止浮动图像下的文本流动
问题描述
https://codepen.io/anon/pen/GevgKR?editors=1100
我有一个网格样式布局,在较小的屏幕上变成卡片布局
网格布局是用 flex 创建的。在卡片布局中,所有元素都向左浮动。布局开始时有一个图像,因此图像下方的文本会变形。
如何停止在图像下方换行的文本。
我想我需要在左侧为图像创建一种假列。我可以用 flex 做到这一点,但这会影响桌面视图上的布局,就像用 flex 所做的那样
*{
font-family: sans-serif;
font-size: 14px;
}
.wrapper{
max-width: 1366px;
width: 90%;
margin-right: auto;
margin-left: auto;
}
.grid{
&__row{
display: flex;
}
&__cell{
border: 1px solid lightgrey;
flex: 1;
}
}
@media(max-width: 700px){
.grid{
overflow: auto;
border: 1px solid lightgrey;
padding: 8px;
&__row{
display: block;
&-header{
display: none;
}
}
&__cell{
border: none;
float: left;
&-image{
height: auto;
clear: right;
}
}
}
}
解决方案
推荐阅读
- android - LinearLayout 仍然没有缩放
- c# - 如何从 xmlnode C# 获取内部文本
- terminal - wget -v -t=5 --no-clobber -x http://www.website.com/ 当我在终端运行这个命令时,这个网站会发生什么?
- node.js - 无法使用纱线在 Laravel 中安装 UIkit 3
- node.js - 使用正则表达式在 Couchdb 查找请求上出现无效的 UTF-8 JSON 错误
- kotlin - Kotlin:获取另一个范围内的范围值
- airflow - 您如何访问 Airflow Web 界面?
- c# - 为每一行调用存储过程不起作用
- xamarin.forms - 直观地编辑 Xamarin 表单页面
- html - 为什么html的嵌套列表不起作用?