我不能在一个div中水平放置一些div。如果可以,我就不能编辑大小!这是代码的一小部分
HTML/PHP
echo \'<div class="makeitseo">\';
foreach ( $res as $service ) {
$serv = get_home_url() . "/" . strtolower( str_replace( " ", "-", normalize( $service->keyword) ) ) . "-k" . $service->id ;
echo
\'<div class="cell"><a href="\' . $serv .\'"><img src="\' . $service->image . \'">\'
.\'<br>\' . $service->keyword .
\'<br>\' . $service->texte .
\'</a></div>\';
}
echo \'</div>\';
CSS
.makeitseo{
width: 100%;
margin: 10px auto;
text-align: center;
display: flex;
justify-content: center;
}
.cell {
margin: 10px, 10px, 10px, 10px;
height: 400px;
width: 400px;
padding: 2px;
display: flex;
align-items: center;
overflow: auto;
}
结果: