column-count - 为什么我的列数不能在 chrome 和 safari 中正常工作?
问题描述
我不明白为什么 chrome 显示 3 列而不是 4 列。我尝试将其更改为 5 或 6,但它仍然显示 3。Safari 根据我的代码正确调整。这是怎么回事?我需要设置宽度属性吗?
我还注意到,如果我将 .placesarticle 更改为 display: block,则显示 4 列,但缩略图和标题会分开。
HTML (& PHP)
<section class="placessection">
<?php
$args = array(
'post_type' => 'places',
'post_status' => 'publish',
'posts_per_page' => '100',
'orderby' => 'title',
'order' => 'ASC',
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
<section class="placesarticle">
<center>
<div class="placescatthumbnail">
<a href="<?php the_permalink();?>">
<?php if (has_post_thumbnail()):?>
<img src="<?php the_post_thumbnail_url();?>" class="thumbnailinplaces">
<?php endif;?>
</a>
</div>
<div class="placescattitle">
<a href="<?php the_permalink();?>"><?php the_title(); ?></a>
</div>
</center>
</section>
</section>
CSS
/* category: places */
.placesarticle {
background-color: #fff;
display: inline-block;
}
.thumbnailinplaces {
width: 100px;
}
@media (min-width: 1000px) {
.placessection {
column-count: 4;
column-gap: 1em;
}
.placesarticle {
margin: 1em;
width: 20vw;
}
}
铬视图:
野生动物园视图:
解决方案
推荐阅读
- julia - jupyter实验室如何配置julia、R、C、C++、Fortran、python?
- php - 如何解决 mysqli_fetch_assoc 错误?
- android - 请告诉我如何在我的 Android 设备上使用 Unity 导入我放入内部存储的视频文件
- batch-file - 如何从 Windows 批处理文件 ssh 跳转到多个主机
- arrays - 从 byte[] 下载 PDF
- java - 带有 JNA 的 USBFS IOCTL 调用在 64 位架构中不起作用
- javascript - 如何使用 java-script 中的 window.print 方法更改页眉和页脚样式?
- wordpress - 如何在 Gutenberg 的 Inspector 控件中添加多条件控制字段?
- java - 使用 java 读取联系人的扩展
- c++ - 如何在文件系统之上添加层?就像 OneDrive 或 Google Drive 中的缓存一样