html - Wordpress 侧边栏定位

标签 html css wordpress stylesheet

我有一个侧边栏,我想将其放置在内容的左侧。我已经尝试了所有我能想到的方法,但无法让边栏显示在页面的左侧。

    <div class="container">
        <header>

        </header>
    <?php if ( is_active_sidebar( 'primary' ) )  {?>
 <div class='cats'>
    <?php dynamic_sidebar( 'primary' );  } ?>
  </div>
        <div class='content_wrapper'>
        <?php if ( have_posts() ) : ?>
        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>

        <div class="posts">
            <article>
               <div class="wrapper">
               <h2 class='headline'><a href="<?php the_permalink() ?>"></h2>

                <div class='thumbs'>

                <p><?php echo content('120'); ?></p>
            </article>
            //.....
                    // some code
               </div>
            </div>
         ... some more code

最佳答案

Please Put this after header, so you can have sidebar at left

<?php get_sidebar(); ?>

对于动态侧边栏使用这个 css

.container
{
    margin:auto!important;
}
.cats
{
    float:left;
    width:30%;
}
.content_wrapper
{
    float:right;
    width:68%;
}

关于html - Wordpress 侧边栏定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18940878/

相关文章:

html - 将不同的 css 样式应用于两个具有相同类名的相同 h4 标签

javascript - 想在这里使用 Canvas 作为背景

css - 如何在 Zerif Lite Wordpress 主题中添加响应 slider

javascript - 使用普通的 javascript/jquery 在数组中创建对象

html - 是否可以使用 HTML5 创建垂直仪表?

javascript - 我们如何知道打开了多少个弹出窗口?

javascript - 随着时间的推移增加字体大小

css - 手机上的图标字体显示问题

css - 如何在 CSS 转换期间防止文本样式默认值

css - 粘性帖子仅在第一页上正确显示