当试图将class属性应用于段落时,文本将保持为黑色,而不是指定的颜色



这是我的信息


.error{
color:rgb(20, 213, 220);
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<title>CSS Basics</title>
</head>
<body>

<div>
<p class="error">abcdefghijklmnopqrstuvwxyz</p>
<p>12345678901234567890123456</p>
<p>doremifasolatidodotilasofa</p>
</div>

</body>
</html>

在样式标签中添加css

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<title>CSS Basics</title>
</head>
<body>
<div>
<p class="error">abcdefghijklmnopqrstuvwxyz</p>
<p>12345678901234567890123456</p>
<p>doremifasolatidodotilasofa</p>
</div>
</body>
</html>
<style>
.error{
color:rgb(20, 213, 220);
}
</style>

天哪!我修复了它——我刚刚忘记把styles.css文件和我的.html文件放在同一个文件夹里,哈哈,我糟糕的

相关内容

最新更新