【发布时间】:2014-08-01 16:08:37
【问题描述】:
学习 CSS 并在我尝试选择的逻辑方面遇到一些问题。我正在尝试使用其他两个更改背景颜色和字体颜色的类来制作全局优惠券样式。黑色样式覆盖了白色样式 p 字体,无法理解为什么。 感谢您的帮助,雅各布 这是 HTML/CSS 的链接
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Coupons Snippet</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>
<body>
<div class="coupon white_c">
<h3><span class="coupon_type_big">50%</span> Off CSS!</h3>
<p>Present this coupon at checkout to receive half off your CSS order!</p>
</div>
<div class="coupon black_c">
<h3><span class="coupon_type_big">50%</span> Off CSS!</h3>
<p>Present this coupon at checkout to receive half off your CSS order!</p>
</div>
</body>
</html>
/*Coupon Style Sheet*/
/*Global Coupon*/
.coupon {
width: 250px;
padding: 10px;
text-align: center;
border: 3px dashed #ccc;
}
.coupon h3 {
font: bold 200% Geneva, Arial, Helvetica, sans-serif;
font-size: 1.3em
}
.coupon_type_big {
font-size: 1.8em
}
/*Coupon White*/
.white_c {
background-color: #f2f2f2;
}
.white_c h3,p {
color: #000;
}
/*Coupon Black*/
.black_c {
background-color: #000;
}
.black_c h3,p {
color: #fff;
}
【问题讨论】: