我在我的網站上的一個頁面上使用wordpress,css列來顯示其子頁面上的一些內容。 我的所有頁面標題都顯示在2列,alpahbeticaly。使用多列css從左到右,而不是從上到下
是這樣的:
第1列|第2欄
頁面標題A | Page Title F
Page Title B | Page Title G
Page Title C |頁標題H
頁面標題D |頁面標題I
頁面標題E |頁面標題Ĵ
這裏是我的HTML和PHP:
<div class="column_artists_menu">
<?php
$args = array(
'post_type' => 'page',
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'title',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$parent = new WP_Query($args);
if ($parent->have_posts()) : ?>
<?php while ($parent->have_posts()) : $parent->the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
</div>
和我的CSS:
.column_artists_menu{
-moz-column-width: 50%;
-webkit-column-width: 50%;
-o-column-width: 50%;
column-width: 50%;
-moz-column-count: 2;
-webkit-column-count: 2;
-o-column-count: 2;
column-count: 2;
-moz-column-gap: 20px;
-webkit-column-gap: 20px;
-o-column-gap: 20px;
column-gap: 20px;
-webkit-column-rule-width: 1px;
-webkit-column-rule-color: #eeeeee;
-webkit-column-rule-style: solid;
-moz-column-rule-width: 1px;
-moz-column-rule-color: #eeeeee;
-moz-column-rule-style: solid;
-o-column-rule-width: 1px;
-o-column-rule-color: #eeeeee;
-o-column-rule-style: solid;
column-rule-width: 1px;
column-rule-color: #eeeeee;
column-rule-style: solid;
}
它完美的作品。 但我的頁面從上到下排序,如上表所示。 我想要做的是讓我的頁面標題像這樣從左到右顯示。
第1列|第2欄
頁面標題A |頁面標題B
頁面標題C |頁面標題D
頁面標題E | Page Title F
Page Title G | Page Title H
Page Title I |頁標題J
有沒有辦法做到這一點,並使用CSS列,這是非常有用的?
非常感謝您的幫助
你有一個在線的例子嗎?這應該可以工作,但它聽起來像你有其他規則干擾。您也可以暫時禁用列寬和邊框,以查看是否因爲所有寬度的總和超過100%而導致問題。 – jeroen
我不確定色譜柱是否是正確的解決方案。爲什麼不在這裏使用簡單的html表格?或者只是'跨度'那條線破壞每一個第二個元素? – grmmph