Wordpress & CSS3 column-count

孤者浪人 提交于 2019-12-24 12:07:02

问题


I'm trying to divide an events list into 2 columns. When I do a simple column-count, I can't seem to get them to align at the top. What am I missing here??

The domain is here

<div id="eventssection">
    <img id="eventheader" src="/images/calendar.png">
    <div id="calendarcol">
    <?php echo do_shortcode('[events]'); ?>
    </div>
    <img id="eventmore" src="/images/moreevents.png">
</div>

#calendarcol {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-width: 15em;
-moz-column-width: 15em;
column-width: 15em;
width: 500px;
margin: 0 auto;
}

Thanks!


回答1:


Add this to your CSS:

.event-item {
    margin: 1em 0 !important;
    float: left;
    width: 250px;
}

The float will make sure that each element is reading the height of the other elements and will then place them accordingly. Though, you will then need to make the width of each element half of the width of your container so that it centers your text in each "column"



来源:https://stackoverflow.com/questions/17050353/wordpress-css3-column-count

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!