I am designing a website from scratch (using Grails, but that's irrelevant). I am having an issue with my menu bar. The form I have seems to have some sort of padding that I cannot remove. If you load up this HTML and CSS, you should be able to see the problem. On the left, there is the menu bar, and underneath it, there is a little gap. How can I fix this?
body{
margin: 0px;
}
.body {
padding:20px;
margin-top:30px;
}
.menu {
margin: 0;
padding: 0;
top: 0;
width: 100%;
position: fixed;
background-color: #333;
}
.menu ul {
list-style-type: none;
overflow: hidden;
display: inline;
-webkit-margin-before: 0px;
-webkit-margin-after: 0px;
}
/* Navigation */
.menu .nav li {
float: left;
}
.menu .nav li a {
display: block;
color: white;
padding: 14px 16px;
text-decoration: none;
}
.active {
background-color: #4CAF50;
}
.menu .nav a:hover:not(.active) {
background-color: #111;
}
/* User */
.menu .login {
float: right;
}
.menu .login form {
padding-top: 10px;
padding-right: 16px;
display: inline;
}
.menu .login li {
display: inline;
}
.menu .login form li input[type="submit"]{
border: none;
background-color: #4CAF50;
}
<html xmlns:g="http://www.w3.org/1999/xhtml">
<head>
<title>
Neon Orb
</title>
<link rel="stylesheet" href="main.css" type="text/css">
<meta name="layout" content="main"/>
</head>
<body onload="">
<div class="menu">
<ul class="nav">
<li>
<a href="/" class="active">
Home
</a>
</li>
<li>
<a href="/about" class="">
About
</a>
</li>
</ul>
<ul class="login">
<form action="/user/login" method="post" name="login" id="login" >
<li>
<input type="text" name="username" placeholder="Username" value="" id="username" />
</li>
<li>
<input type="password" name="password" placeholder="Password" value="" id="password" />
</li>
<li>
<input type="submit" name="_action_Login" value="Login" />
</li>
</form>
</ul>
</div>
<div class="body">
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
</body>
</html>
On Chrome, there is a workaround, -webkit-margin-after/before
that is set to 16px, and it can be overridden. This doesn't work on Firefox though.