css - React + SCSS:无法使用 flexbox display-flex
问题描述
注意:我将 boostrap css 用于其他一些组件。
ISSUE =>
我希望text-area
andimage
并排:
html:
<div class="card">
<div class="card__text">
<div>
<h3 class="card__text-title">Leed guitarist</h3>
<p>Some random lorem ipsum text to see how this thing looks here.
It will have around 300 characters...</p>
</div>
<div class="card__text-buttons">
<a hef="#">Like</a>
<a hef="#">Know more</a>
</div>
</div>
<div class="card__img">
</div>
</div>
scss:
.card {
overflow: hidden;
margin: 5px 5px;
max-width: 400px;
min-height: 200px;
display: flex !important; // <<=== WON'T WORK !!
box-shadow: 3px 3px 11px 0px rgba(0,0,0,0.75);
&__img {
flex: .4;
min-height: 200px;
// css properties
}
&__text {
flex: .6;
// css properties
flex-direction: column;
justify-content: space-between;
&-title {
font-weight: 800;
}
&-buttons {
display: flex;
a {
// css properties
}
}
h3 {
margin-top: 20px;
}
p {
margin-top: 30px;
font-size: 13px ;
}
}
}
当前结果
我不确定我是否做错了什么。我很沮丧,因为我似乎无法弄清楚。
很确定我在这里遗漏了一些非常小的东西。提前致谢!
解决方案
我能够在这里复制您的问题https://codepen.io/dpogni/pen/bGedwbZ
您需要添加flex-direction: row;
到您的卡类。
推荐阅读
- android-studio - 为什么活动选项被禁用?
- mysql - MYSQL:棘手的查询 - 需要构建中间变量?
- r - R根据条件生成随机数
- c++ - C++ 应用程序不读取 json 文件 - Docker 容器
- c# - Application Insights 中的 Azure 函数 TimerTrigger 结果代码始终成功
- node.js - 赋值时返回未定义的结果对象
- mysql - 如何根据另一个模型数据验证字段
- git - 有没有办法取回已删除分支的变更集历史记录?
- scala - Scala List 映射到具有下一个和上一个值的另一个列表
- laravel - Laravel Dropbox 更新时的初始值