【问题标题】:Changes to style.css not showing up对 style.css 的更改未显示
【发布时间】:2014-08-07 20:20:58
【问题描述】:

我的网站,pretendcity.org 有一个由其他人创建的自定义主题。要编辑内容,我使用dreamweaver 并进入服务器打开各个文件(例如:如果我需要在标题中添加一些内容,我将编辑header.php)。

我的问题是,当我编辑/更新网站的 style.css 文件时,它不会立即更新。例如,我将背景颜色从 #353535 更改为 #000000 并且没有任何变化。因此,我在 style.css 中将背景颜色保留为 #000000 数周,但在网站上未发现任何更改。然后今天WordPress自动更新到3.9.2,发现背景色突然变成了#000000。

现在我正在尝试将其改回 #353535,但它不会进行任何更改。

这是网站的 style.css:

@charset "UTF-8";
/*
Theme Name: Pretend City Children's Museum
Theme URI: http://pretendcity.org
Description: Pretend City v2
Author: Slava Popov
Author URI: http://laydbak.com
*/

/* =================
0081cd - Blue
83bc34 - Green
353535 - Text
cbcbcb - Borders
==================*/

/* =========== */
/* Page Styles */
/* =========== */

body {
    background: #f0f0f0;
    color: #353535;
    font: 12px Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    text-align: center;
    width: 100%;
    }
img {border: 0;}
table {margin: 0 0 10px 0; padding: 0; line-height: 19px; vertical-align: top !important; border-spacing:0; border-collapse:collapse;}
td {vertical-align: top !important;}
p {line-height: 19px; padding-bottom: 10px;}
h2, h3, h4, h5, h6 {color: #353535; margin-bottom: 10px;}
h1 {color: #0081cd; font-size: 24px; margin: 0 0 10px 0;}
h2 {color: #353535; font-size: 18px;}
h3 {color: #83bc34; font-size: 16px;}
h3 a {color: #83bc34;}
h4 {font-size: 14px;}
h5 {font-size: 14px;}
h6 {color: red; font-size: 11px;}
hr {
    border: none 0;
    border-top: 1px dashed #ccc;
    height: 1px;
    margin: 20px 0;
    width: 100%;
    }
a {color: #0081cd; text-decoration: underline;}
a:hover {text-decoration: none;}
ul {
    line-height: 19px;
    list-style-type: disc;
    padding: 0 0 20px 20px;}
.wrap {
    background: #FFF;
    border-left: #cbcbcb 1px solid;
    border-bottom: #cbcbcb 1px solid;
    border-right: #cbcbcb 1px solid;
    margin: 0 auto;
    position: relative;
    width: 958px;
    }

这里是 header.php 代码:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>"/>
<meta property="twitter:pretendcity" content="42741399" />
<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="shortcut icon" href="<?php bloginfo( 'template_directory' ); ?>/favicon.ico" />
<link href="<?php bloginfo( 'template_directory' ); ?>/reset.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?php echo get_stylesheet_uri(); ?>" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="<?php bloginfo( 'template_directory' ); ?>/shortcode.css" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="<?php bloginfo( 'template_directory' ); ?>/print.css" rel="stylesheet" type="text/css" media="print" />
<!--[if IE]><link rel="stylesheet" type="text/css" href="<?php bloginfo( 'template_directory' ); ?>/all-ie-only.css" /><![endif]-->
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>

<!-- BEGIN GOOGLE ANALYTICS -->
 <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-38311913-1', 'pretendcity.org');
  ga('send', 'pageview');

</script>
<!-- END GOOGLE ANALYTICS -->
</head>

<!--[if IE 7]>  <body class="lt-ie8">   <![endif]-->

<body <?php body_class(); ?>>

<!-- Top Info Bar -->
<div id="infobar">
    <div>
        <span><strong>Address:</strong> 29 Hubble, Irvine, CA 92618 (<a href="https://www.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Pretend+City+Children's+Museum,+29+Hubble,+Irvine,+CA&amp;aq=0&amp;oq=Pretend&amp;sll=33.835232,-117.8461&amp;sspn=0.246678,0.528374&amp;vpsrc=0&amp;ie=UTF8&amp;hq=Pretend+City+Children's+Museum,+29+Hubble,+Irvine,+CA&amp;t=m&amp;z=15&amp;iwloc=A&amp;cid=12592966360647214510" target="_blank" class="map">Get Directions</a>)</span>
        <span><strong>Phone:</strong> 949.428.3900</span>
        <span><strong>Hours:</strong> Tues. - Sun.. 10a.m. - 5p.m.</span>
        <span>Monday 10a.m. - 1p.m.</span>
        <strong>Ages:</strong> Infants to 8 years old
    </div>
</div>
<!-- Header & Logo -->
<header>


    <a href="/">
        <div class="logo" title="Pretend City Children's Museum"></div>
    </a>

    <!-- <a href="https://tickets.pretendcity.org/public/loader.asp?target=donation.asp?code=0013" target="_blank"> -->
    <a href="https://16116.blackbaudhosting.com/16116/General-Contributions" target="_blank">
        <div class="donate" title="Donate Today!"></div>
    </a>
<!-- Paypal Donate Button -->
      <div class="paypalicon" style="margin-top:55px; margin-left: 600px"><form title="Donate Today!" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="228Z5CXX3WVT8" />
<input type="image" alt="PayPal - The safer, easier way to pay online!" name="submit" src="http://pretendcity.org/images_home/donate-with-paypal-button-54.png" />
<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" border="0" /></form></div>



</header>
<!-- Main Body Wrapper -->
<div class="wrap">
    <!-- Navigation Start -->
    <nav id="menu">
        <?php wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => 'main-navigation', 'menu_class' => 'nav-menu' ) ); ?>
    </nav>

【问题讨论】:

  • 您不能登录 wp-admin 面板并在那里编辑 CSS 吗?它是这样设置的,因此您不必使用 Dreamweaver。
  • 硬刷新,在浏览器中按 CTRL + F5,您可能会看到缓存的 CSS。请参阅此处了解使其停止的方法:css-tricks.com/snippets/wordpress/prevent-css-caching
  • 我使用了一个 ingonito 窗口,清除了我的缓存,然后按 CTRL + F5 仍然是一样的......没有看到任何变化

标签: php css stylesheet


【解决方案1】:

CSS 文件可能会在浏览器中变现。尝试使用 CTRL+F5(IE、FF 或 Chrome)刷新页面

【讨论】:

    【解决方案2】:

    尝试更改 css 文件,然后打开此站点并打开链接的样式表,然后检查这些更改是否存在于样式表中。如果您看到那里的更改,然后使用开发工具找出更改的问题,也许某些样式会覆盖您的样式。也可以试试 cmets 的ctrl + f5 解决方案。

    【讨论】:

    • 这就是我过去所做的,当我检查源代码时,我所做的更改没有显示出来。
    猜你喜欢
    • 1970-01-01
    • 2014-12-03
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多