Search code examples
htmlcssnavbarbackground-color

nav's background-color cut when zoom


Hello everyone i'm new at coding and i need a little help on my nav bar i used on my css "white-space: nowrap;" to avoid wrapping on my nav bar and when i scroll to the right after that, on my zoomed page the background color is cut

Can you help to put my background colour completyly to the right? or advice are welcome ! Thank you

Without zoom

With zoom

My html

  <!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <title>Conférence des directeurs des écoles doctorales de droit</title>
    <link rel="stylesheet" href="css/master.css">
  </head>
  <body>
      <nav><ul>
        <li><a href="#">Présentation</li>
        <li><a href="#">Liste des ED</li>
        <li><a href="#">Documents</li>
        <li><a href="#">Liens</li>
        <li><a href="#">Infomations/IP</li>
        <li><input id=search-button type="submit" name="search_button">
            <input id=search-box type="text" name="search_box" placeholder="Rechercher..."></li>
      </ul></nav>

  </body>
</html>

my css

 @font-face {
    font-family: "Quicksand Light Regular";
    src: url('quicksand_light-webfont.woff');
}

nav {
    position: absolute;
    background-color: darkred;
    top: 0;
    right: 0;
    left: 0;
    white-space: nowrap;
    text-align: center;
    max-width: 100%;
    zoom: 1;
}

nav li {
    font-family: "Quicksand Light Regular";
    font-weight: bold;
    display: inline-block;
    margin-right: 45px;

}

a {
    color: white;
    text-decoration: none;
}

Solution

  • Someone found the solution for me i had to remove right : 0; and add min-width:100%; Thx for everyone

    nav {
    background-color: darkred;
    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%;
    white-space: nowrap;
    text-align: center;
    

    }