title: Menu Styling, css, html. Avoiding Overflow of top menu
body: <p>I am building an asp.net mvc application. I have my top menu structure which is in my master page. It seems to render differently on either different screen sizes or different screen resolutions. This leaves the menu structure looking terrible. I want it to be the same at all times. <strong>Below is my master page html:</strong></p>
  
  <pre><code>&lt;body&gt;
  &lt;div class="page"&gt;
  
      &lt;div id="header"&gt;
          &lt;div id="badge" style="float:left; width:20%;"&gt;&lt;img src="../../Content/Images/School_Badge.jpg" alt="badge"/&gt;&lt;/div&gt;
  
          &lt;div id="title" style="width:80%;"&gt;
              &lt;h1&gt;School&lt;/h1&gt;
              &lt;h2&gt;
              School Motto: Famba &lt;br /&gt;
              English Meaning: Move Forward
              &lt;/h2&gt;
          &lt;/div&gt;
  
          &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;div id="menucontainer"&gt;
  
              &lt;ul id="menu"&gt;              
                  &lt;li&gt;&lt;%: Html.ActionLink("About us", "Index", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Admissions", "Admissions", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Boarding", "Boarding", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Academic", "Academic", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Cultural", "Cultural", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Sport", "Sport", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Staff members", "Staff", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%: Html.ActionLink("Contact us", "ContactUs", "Home")%&gt;&lt;/li&gt;
              &lt;/ul&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="main"&gt;
          &lt;asp:ContentPlaceHolder ID="MainContent" runat="server" /&gt;
  
          &lt;div id="footer"&gt;
          P.O Box 507 School| Phone: +23232 39 265064 | Fax: +232332 39 266043 |
          © Copyright Private School &lt;%: DateTime.Now.Year %&gt; &lt;br /&gt; &lt;br /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>and the css related to this is as follows:</strong></p>
  
  <pre><code>.page
  {
      width: 72%;
      margin-left: auto;
      margin-right: auto;
  }
  
  #header
  {
      position: relative;
      margin-bottom: 0px;
      color: #000;
      padding-top: 20px;
  }
  
  #header h1
  {
      font-weight: bold;
      padding: 5px 0;
      margin: 0;
      color: #fff;
      border: none;
      line-height: 2em;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 32px !important;
  }
  
  #header h2
  {
      font-weight: bold;
      padding: 5px 0;
      margin: 0;
      color: #fff;
      border: none;
      line-height: 2em;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 14px !important;
  }
  
  #main
  {
      position:relative;
      padding: 30px 0px 15px 0px;
      background-color: #fff;
      margin-bottom: 30px;
      _height: 1px; /* only IE6 applies CSS properties starting with an underscore */
  }
  
  #menucontainer
  {
      margin-top:100px;
  }
  
  div#title
  {
      display:block;
      float:left;
      text-align:left;
  }
  
  ul#menu
  {
      border-bottom: 1px #5C87B2 solid;
      padding: 0 0 2px;
      position: relative;
      margin: 0;
      text-align:center;
  }
  
  ul#menu li
  {
      display: inline;
      list-style: none;
  }
  
  ul#menu li#greeting
  {
      padding: 10px 20px;
      font-weight: bold;
      text-decoration: none;
      line-height: 2.8em;
      color: #fff;
  }
  
  ul#menu li a
  {
      padding: 10px 20px;
      font-weight: bold;
      text-decoration: none;
      line-height: 2.8em;
      background-color: #e8eef4;
      color: #151B54;
  }
  
  ul#menu li a:hover
  {
      background-color: #fff;
      text-decoration: none;
  }
  
  ul#menu li a:active
  {
      background-color: #a6e2a6;
      text-decoration: none;
  }                                                                                     
  
  ul#menu li.selected a
  {
       background-color: #fff;
       color: #000;
  }
  </code></pre>
  
  <p>The first image shows the Correct display all the time, and the second one shows Incorrect display, what I am trying to avoid.</p>
  
  <p><img src="https://i.stack.imgur.com/vxujr.png" alt="Correct display all the time"></p>
  
  <p><img src="https://i.stack.imgur.com/0IHQN.png" alt="Incorrect display, what I am trying to avoid"></p>