【发布时间】:2020-11-07 19:22:12
【问题描述】:
Whats up devs,所以我试图在网格中显示电影海报,但有些海报的大小不一样,在某些情况下会发生这种情况:
https://i.stack.imgur.com/0YOR8.png
我有这段代码是用 styled-components 编写的
import styled from 'styled-components';
const Container = styled.div `
max-width: 1360px;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
box-sizing: border-box;
&before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
`;
export const Row = styled.div`
width: 100%;
height: auto;
float: left;
box-sizing: border-box;
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear:both;
}
`;
export const Column = styled.div`
float: left;
padding: 10px;
min-height: 1px;
box-sizing: border-box;
width: 100%;
img{
width: 70%;
}
@media only screen and (min-width: 768px) {
width: ${(3 / 12) * 100}%
}
`;
export default Container;
【问题讨论】:
-
您希望发生什么?所有对象都以相同的大小显示并且不像拼图块那样适合?
-
是的,像这样打印i.imgur.com/Coxoovu.jpg
标签: css reactjs styled-components