0
我想對齊左邊的內容和右邊的部件區域以水平線堆疊。這是我的代碼: -WordPress的模板對齊
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="page-box"><!--page wraper box-->
<?php
while (have_posts()) : the_post();
get_template_part('template-parts/content', 'page');
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</div><!--page wraper box-->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar('left');
get_sidebar('right');
get_footer();
和CSS: -
/* Right side widgets. */
.right-widgets{
float:right;
margin-right:-300px;
}
/* Left side widgets. */
.left-widgets{
float:left;
margin-left:-300px;
}
.site-content{
position:relative;
width: 1000px;
width: 62.5rem;
margin: 2em auto 0em;
}
.content-area {
width: 100%;
float:none;
display:inline-block;
position:relative;
clear:none;
}
.site-content .widget-area {
position:relative;
overflow: hidden;
width: 300px;
padding:1em;
display:inline-block;
clear:none;
}
會發生什麼事是,它是定位部件領域的左,右,因爲它應該,但下面的內容區域,而不是線。
當我在內容區域正常工作之前加載左側邊欄,但在移動屏幕上的左側邊欄加載內容之前,我希望兩個邊欄在內容之後出現。 任何想法我在這裏做錯了什麼?
那麼我將不得不嘗試,謝謝 –
也許不是那麼優雅的解決方案,但它的工作原理 –