I created a small web page using html and css. i tried to change the color of list "a". but it is not working. what might be the problem?
try: i tried to change the color of list a using class color. but the code is not working.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Adding CSS</title>
</head>
<body>
<h1>Three Methods of Adding CSS</h1>
<a href="./inline.html">Inline</a>
<a href="./internal.html">Internal</a>
<a href="./external.html">external</a>
<ol>
<li class="color" >a</li>
<li>b</li>
</ol>
</body>
</html>
css
h1 {color: green;}
.color {
color:red
}
expecting :
what i’m expecting is to change the color of the list a using class color but it is not changing. what might be the error?
2
Answers
The code you wrote works as expected, but you did not connect the CSS with HTML.
Add this to your
<head>
of the html or open a<style>
and put your css in it.<link rel="stylesheet" href="style.css">
your code is working fine. You must include the CSS file if you are using external CSS. And you forgot to add the semicolon after the {color: red} property.