title: Centering menu bar with CSS
body: <p>I have two problems with my menu bar. What I want to achieve is to center the links on the header (including the logo picture) and have exactly the same height for the header as the menu. When I add the links it creates a margin on top and on bottom (so the header will extend) and I have no idea why. The margin size depends on the font size and if I want to remove it I have to add a -something px margin and have to try pixel by pixel what the number should be. I'm pretty sure there's an easier solution to that... My other problem is that I can't center the whole menu bar within the header unless I specify a specific width. Obviously I don't know how wide my menu bar will be (and even if I measure it somehow, what if I change the links later?) I'm fairly new to HTML and CSS so I've probably made a bunch of mistakes, I just keep changing the codes until I get what I want but since I'm trying to learn it better I'm aiming for more understanding than random coding so feel free to correct anything. Here's the HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;My website&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="images/style.css" /&gt;
  &lt;link href='http://fonts.googleapis.com/css?family=Belleza' rel='stylesheet'   type='text/css'&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div id="header"&gt;
  &lt;div id="menu"&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;img src="images/ncs.png" /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Link 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Link 2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Link 3&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Link 4&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Link 5&lt;/a&gt;&lt;/li&gt;
  &lt;li id="right"&gt;&lt;a href="#"&gt;English&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the CSS:</p>
  
  <pre><code>@charset "utf-8";
  
  body {
  background-color: #efe8df;
  }
  
  #header {
  width: 100%;
  height: auto;
  background-color: #afafaf;
  position: absolute;
  top:0px;
  left:0px;
  right:0px;
  }
  
  #menu {
  margin: auto;
  padding: 0px;
  list-style: none;
  font-family:'Belleza', sans-serif;
  color: white;
  font-size: 22px;
  /*width: 1000px;*/
  height: auto;
  position: relative;
  }
  
  #menu li {
  list-style: none;
  width: auto;
  height: auto;
  text-align: center;
  vertical-align: middle;
  display: table-cell;
  border-right: 1px solid #ebeaea;
  }
  
  #menu li a {
  color: #FFFFFF;
  text-decoration: none;
  display: block;
  padding: 30px;
  border-bottom: 3px solid transparent;
  }
  
  #menu li a:visited {
  color: #FFFFFF;
  text-decoration: none;
  display: block;
  padding: 30px;
  border-bottom: 3px solid transparent;
  }
  
  #menu li a:hover {
  color: #46b5c2;
  text-decoration: none;
  background-color: #ebeaea;
  display: block;
  padding: 30px;
  border-bottom: 3px solid #46b5c2;
  }
  
  #menu li a:active {
  color: #46b5c2;
  text-decoration: none;
  background-color: #ebeaea;
  display: block;
  padding: 30px;
  border-bottom: 3px solid #46b5c2;
  }
  
  #menu #right {
  border-right: 0px;
  font-family: Georgia;
  font-size: 14px;
  }
  </code></pre>
  
  <p>Thanks in advance!</p>