0

I am trying to bridge the gap between navigation menus so that the red background is completely covered.

<nav>
    <a class="current_page" href="index.php"><span class="glyphicon glyphicon-home"></span> Home </a>
    <a href="blog.php"><span class="glyphicon glyphicon-pencil"></span> Blog</a>
    <a href="photography.php"><span class="glyphicon glyphicon-camera"></span> Photos </a>
    <a href="videos.php"><span class="glyphicon glyphicon-facetime-video"></span> videos</a>
    <a href="feedback.php"> Feedback </a>
    <a href="about.php"> About </a>
</nav>

and my css is:-

nav{
    background-color:red;
    padding:0px;
    margin:0px;
}

a{
  margin:0px;
  padding:5px;
  font-family:arial;
  font-size:16px;
  font-weight:bold;
  display:inline-block;
  background:#6a97d5;
}

https://jsfiddle.net/z4gLqp61/3/

Goldensquare
  • 331
  • 3
  • 17
  • @MohammadUsman Yep, it is a duplicate. [Removing `white-space` between `a` works.](https://jsfiddle.net/z4gLqp61/10/) – deEr. Apr 21 '18 at 06:22

2 Answers2

0

Change Margin CSS like:

 a{
    margin:0px -5px;
    padding:5px;
    font-family:arial;
    font-size:16px;
    font-weight:bold;
    display:inline-block;
    background:#6a97d5;
}
ravi polara
  • 564
  • 3
  • 14
-1

you just need to add

a { margin-right:-4px; }

because whenever you write display:inline-block it takes an additional margin-right:4px

so, you need to remove it by adding CSS code.

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
BigFan
  • 1
  • 1