So I am currently learning how to use html and CSS and I decided to test myself with a very small project. When I finished I ran into a small problem that I don't know how to fix.
Here is my html
(Note: I am using jsfiddle.net so things like !DOCTYPE html and head aren't a concern)
div {
width: 300px;
background-color: rgb(255, 145, 145);
border: 1px solid black;
border-radius: 20px;
font-size: 1.5em;
margin: auto;
padding: 2px
}
div:hover {
background-color: rgb(255, 100, 100)
}
div:active {
background-color: rgb(255, 75, 75);
}
a {
text-decoration: none;
color: rgb(145, 230, 255);
font-family: serif, cursive;
font-weight: bold;
}
span {
color: red;
font-family: Comic Sans MS;
}
<a href="#" target="_blank">
<div>
<p>
When you click on it, this button will take you to<span>Codecademy</span>, where I learned how to make things like this.
</p>
</div>
</a>
The problem is that the margin of my divs are clickable and that is exactly what I don't want. Please also remember that I am a beginner so please explain why this is happening as simply as possible.