I have the following code in CSS:
a{
margin: 10px;
padding: 10px;
background-color: black;
color: white;
font-family: Cambria;
text-decoration: none;
}
a:hover {
background-color: grey;
}
You see, the code here works fine. The desired result of my link being turned grey upon hovering is achieved. The question here is wondering as to why the code stops to change the background-color property to grey when I add a space between a
and/or :hover
.
Here is my HTML code just for reference
<!DOCTYPE html>
<html>
<head>
<title>Crescive</title>
<link rel="stylesheet" href="./style.css" />
<meta charset="utf-8>
</head>
<body>
<main> <!-- I want people to click this -->
<header>
<h1>Crescive</h1>
<p>A customs forms service!</p>
<a href="./create.html">Try it out!</a>
</header>
</main>
</body>
</html>
PS On a side note, if anyone could tell me if I am making good use of the sectioning tags, that would be greatly appreciated!