css - Wordpress 上的 CSS 问题

标签 css wordpress sidebar

我正在尝试对我的 sidebar.php 进行编码,但它中断并一直低于帖子

PHP:

<!-- begin sidebar -->
<div id="menu">
<?php  /* Widgetized sidebar, if you have the plugin installed. */
  if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    <label for="s">SEARCH</label>
    <form id="searchform" method="get" action="#">
      <div>
        <input type="text" name="s" id="s" size="15" />
        <br />
        <input type="submit" value="TYPE HERE_" />
      </div>
    </form>
  <div class="bg-sidebar">
    <h2>MOST READ</h2>
    <ul>
      <li><a href="javascript:void(0);">Worth A Thousand Words</a></li>
      <li><a href="javascript:void(0);">Feed Your Head</a></li>
      <li><a href="javascript:void(0);">Aliquam tempus, eros commodo porta pretium</a></li>
      <li><a href="javascript:void(0);">Pellentesque quis libero dui</a></li>
      <li><a href="javascript:void(0);">Lorem ipsum dolor sit amet</a></li>
    </ul>
    <h2>RECENT POSTS</h2>
    <ul>
      <li><a href="javascript:void(0);">Worth A Thousand Words</a></li>
      <li><a href="javascript:void(0);">Feed Your Head</a></li>
      <li><a href="javascript:void(0);">Aliquam tempus, eros commodo porta pretium</a></li>
      <li><a href="javascript:void(0);">Pellentesque quis libero dui</a></li>
      <li><a href="javascript:void(0);">Lorem ipsum dolor sit amet</a></li>
    </ul>
    <h2>ARCHIVE</h2>
    <ul>
      <li>
        <?php wp_get_archives('type=monthly'); ?>
      </li>
    </ul>
    <h2>LINKS</h2>
    <ul>
      <li><a href="http://www.t.com">t</a></li>
      <li><a href="http://www.tt.com">tt</a></li>
    </ul>
  </div>
  <?php endif; ?>
</div>

CSS:

* { margin: 0; padding: 0; }
body, input { font-family: "Trebuchet MS"; font-size: 12px; }
.move { clear: both; height: 0; float: none !important; }
body { background: url(images/bg.gif); width: 991px; position: absolute; top: 0; left: 50%; margin: 0 0 0 -495px; padding: 0 0 71px 0; }
a { text-decoration: none; }
li { list-style: none; }
img { border: 0; }

 #searchform { float: left; width: 366px; height: 27px; }
 #searchform * { float: left;}
 #searchform label { width:75px; height: 26px; border: solid 1px #ab0000; border-width: 1px 1px 0 0; text-align: center; line-height: 25px; font-weight: bold; font-size: 18px; color: #ab0000; background: white; }
 #searchform p { border-bottom: solid 1px #ab0000; width: 290px; height: 25px; }
 #searchform input { border: 0; margin: 6px 0 0 10px; display: inline; width: 234px; font-weight: bold; color: #999999; background: transparent; outline: none; height: 16px; }
 #searchform button { background: url(images/btn_vai.gif); width: 34px; height: 24px; border: 0; margin: 0 0 2px 0; float: right; }

#menu { width: 366px; height: 40px; float: left; margin: 1px 0 0 0; }
.bg-sidebar { background: white; width: 366px; padding: 50px 0 0 0; }
#menu h2 { color: #ab0000; font-size: 18px; line-height: 18px; padding: 0 0 10px 15px; }
#menu ul { border-top: solid 1px #d5d5d5; padding: 0 0 38px 0; }
#menu li { border-bottom: solid 1px #f3f2f2; line-height: 30px; font-size: 13px; font-weight: bold; padding: 0 0 0 24px; }
#menu li a { color: black; }

有人可以帮我解决这个问题吗?

最佳答案

低于 Wordpress 内容的侧边栏通常只是缺少结尾 </div>标签或两个。在 The W3C Markup Validation Service 使用 xhtml 代码验证器查看您的网站和页面。在“选项”中勾选“显示源”复选框,您将获得一个代码 list ,指出您的哪些主题文件有问题。比较侧边栏位置正确的页面和损坏的页面。

关于css - Wordpress 上的 CSS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2516660/

相关文章:

php - 如何在没有 WP_Query 'title' 的情况下搜索帖子的 ,'content' &'meta_query' 's' ?

python-sphinx - 仅在侧边栏中的 Sphinx toctree

html - 将侧边栏一分为二

javascript - 更改 div 属性标题颜色

php - Wordpress: "Fatal error: Allowed memory size..."任何时候我尝试在functions.php 文件中注册和排队脚本

javascript - WordPress 插件 : how do you pass parameters to be used as attributes in a javascrtipt tag?

php - 根据页面隐藏侧边栏上的内容

css - 如何根据屏幕尺寸/设备使用特定的 CSS 样式

css - 渐变 Angular 冲突

css - 使一个 div 在悬停在另一个 div 上时出现