drb88830 2014-08-07 14:33
浏览 65
已采纳

自定义CSS类无法正常工作

I have added custom CSS to style.css file on my own custom skin in Wordpress 3.9.2. All classes seem to be working fine, apart from the new ones that I have added.

.frontpage_tile {
    width: 270px;
    float: left;
    min-height: 1px;
    margin-left: 30px;
}

.block {
    display: block;
    position: relative;
}

.block img {
    display: block;
    border: 1px solid rgba(53, 53, 53, 0.65);
    box-sizing: border-box;
    border-radius: 3px;
}

.block .caption {
    font-size: 13px;
    font-weight: normal;
    line-height: 1.2em;
    padding: 10px;
    margin: 0px;
    position: absolute;
    bottom: 1px;
    left: 1px;
    right: 1px;
    color: #FFF;
    background: none repeat scroll 0% 0% rgba(0, 0, 0, 0.6);
    text-shadow: 0px 0px 20px #000, 0px 0px 10px #000;
    z-index: 1;
}

The above code is just ignored by all browsers. It does not appear on the page, nor on "Inspect Element" in the browser. Any ideas? This is the code I am using on the template, which I am calling on the custom page.

<div class="frontpage_tile">
    <a class="block" href="<?php echo get_permalink(); ?>" data-icon="&#xe00b;">
      <?php the_post_thumbnail('home-thumb'); ?>
      <span class="caption">
          <?php the_title(); ?>
      </span>
    </a>
</div>
  • 写回答

2条回答 默认 最新

  • dongyi2425 2014-08-07 14:50
    关注

    I just scanned your website with wpscan for the sake of it, and here's your problem:

    [+] Interesting header: CF-RAY: 15644be6d86308d8-LHR
    [+] Interesting header: SERVER: cloudflare-nginx
    [+] Interesting header: X-CF-POWERED-BY: WP 1.3.14
    [+] Interesting header: X-POWERED-BY: PHP/5.5.14
    

    You're using Cloudflare :) , just login into your Control Panel and enable Development mode.

    I'll leave the old answer below, just in case someone finds this question and wants to know how to do a bit of troubleshooting:

    If you go at the top of your stylesheet you'll see the following comments:

    /*
    Theme Name: Twenty Ten
    Theme URI: http://wordpress.org/
    Author: the WordPress team
    [...]
    Version: 1.4
    [...]
    */
    

    Just change your number version and Wordpress now will serve the stylesheet with the new version number, forcing your browser to re-download it, otherwise while you're under development you can register your CSS in that way (which is really handy):

    wp_enqueue_style( 'main-style', get_stylesheet_uri(), array(), time() );
    

    This enforces to append a timestamp on the CSS as query variable, so your browser believes that's a new file and the new fresh CSS gets downloaded every time you refresh the page.

    Generally the CTRL/CMD + SHIFT + R works without any problem, if you still see your old CSS even with those changes one of these is probably what is causing problems:

    • Your website is using Cloudflare and you forgot to enable dev mode
    • Your wordpress is running a caching plugin
    • You're uploading your file in the wrong place

    Cheers

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料