我最近在php语句中给出了一个给定消息的消息框,并且它们设计了消息的样式。为什么我的css没有被应用到我的页面?
这是我的php代码。
mysql_query("UPDATE account SET is_active=1, activation_code='' WHERE activation_code='$code'");
$message_good = '<div class="register_thankyou"><p>Success! Your account has been activated. You may now <a href="login.php">log in</a>.</p></div>';
} else {
$message_good = '<div class="register_error"><p>Account has already been activated, or you have an invalid activation code.</p></div>';
}
出于某种原因,它加载样式register_thankyou而不是register_error。
这两种风格都有这个CSS设置。
/* ACTIVATION MESSAGES */
.register_thankyou {
background-color: #e3f6da;
border: 1px solid #3b7008;
padding: 20px;
}
.register_thankyou h3 {
font-size: 20px;
font-weight: normal;
margin: 0 0 10px;
padding: 0;
}
.register_thankyou p {
margin: 0;
padding: 0;
}
.register_error {
background-color: #f8e5e4;
border: 1px solid #c41100;
padding: 20px;
}
.register_error h3 {
font-size: 20px;
font-weight: normal;
margin: 0 0 10px;
padding: 0;
}
.register_error p {
margin: 0;
padding: 0;
}
所有这就是不同的是背景和边框颜色
可为什么有人正在应用和其他心不是一个风格向我解释?
谢谢:
错误:
它可以在这里寿:http://jsfiddle.net/q8ozgfmu/
**不再支持** mysql_ *'函数,它们是[**官方不推荐使用的**](https://wiki.php.net/rfc/mysql_deprecation),**不再维护**,将来会[**删除**](http://php.net/manual/en/function.mysql-connect.php#warning)。您应该使用[PDO](http://php.net/pdo)或[MySQLi](http://php.net/mysqli)更新您的代码,以确保您的项目未来的功能。 – Kermit 2014-10-12 13:20:19
感谢il更新,但那不是什么导致这个问题... @Kermit – 2014-10-12 13:23:48
页面/ HTML的其余部分显然有一些问题 - 没有看到代码是不可能知道的。您是否检查过浏览器的Inspector/Developer工具中的样式,以了解它们未被应用的原因? – 2014-10-12 13:28:04