I am making a set of navigation links. Whenever: hover styles are activated, it becomes obvious that there is a small one around the link (maybe 2px?). I tried using margin:0;in styles ato remove it, without any success. I also tried setting margin:0;to parent div, but again, no luck.
I have provided the code in the snippet below to illustrate the problem. Does anyone know what causes this and, in turn, how to fix it?
Thank!
div#top > div#nav-container a:hover {
color:#f7902b;
background-color:#fff;
}
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" />
</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>
Run codeHide result
source
share