Search code examples
htmlcssfontsfont-sizegoogle-webfonts

Google Web font, font weight changes


For some reason my google web font in the navigation menu keeps on changing its weight from page to page although I have set it to 700. The CSS for the menu is identical on each page. Could somebody please tell me whats going on as I have never found this before.

For future posterity reasons I shall delete the live link as soon as somebody answers. Thanks!

My CSS is

* {
font-family: 'Lato', sans-serif;
}

#menu {
font-weight:700;
display: table;
width: 100%;
list-style: none;
position: relative;
top: -20px;
text-align: center;
left: -10px;
-webkit-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
font-size: 18px;
height: 20px;
z-index: -101;
}

Solution

  • Firstly, you need to fix this:

    body {
    background-color: #FFF;
    background-image: url(bg.png);
    color: #D6D6D6;
    font-family: font-family: 'Lato', sans-serif;
    }
    

    Your font-family declaration is duplicated.

    Secondly, your 700 is being overridden by the #menu li a class here:

    #menu li a {
      display: block;
      padding: 2px 10px;
      text-decoration: none;
      font-weight: lighter; /*should be changed to 700*/
      white-space: nowrap;
      color: #333;
    }