I'm making a set of navigation links. Whenever their :hover stylings are activated it becomes obvious that there is a small (maybe 2px?) margin all around the link. I've tried using margin:0;
on the a
styles to remove it, with no success. I've also tried setting margin:0;
on the parent div
, but again, no luck.
I've included the code in a snippet below to illustrate the problem. Does anyone know what is causing this and, in turn, how to fix it?
Thank you!
/* Animations */
div#top > div#nav-container a:hover {
color:#f7902b;
background-color:#fff;
}
/* Regular CSS */
div#top {
background-color:#333;
padding-top:10px;
padding-bottom:10px;
}
div#top > div#nav-container {
text-align:center;
}
div#top > div#nav-container a {
text-decoration:none;
color:#fff;
padding:10px 20px;
transition:color 0.25s,background-color 0.5s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="assets/bootstrap/css/custom/nav.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="top" class="col-md-12">
<div id="logo-container" style="margin:auto;width:200px;">
<img src="assets/images/logo-banner.png" style="width:100%;" />
</div>
<hr style="margin:10px 0 10px 0;border-color:#444;" />
<div id="nav-container">
<a href="#">Breaking</a>
<a href="#">Politics</a>
<a href="#">Military</a>
<a href="#">Economy</a>
<a href="#">Development</a>
</div>
</div>
</body>
</html>