Fixed navbar, white gap, why? - html

I want to ask you why i get this white gap when i want to do fixed scroll navbar on top ? Do you guys have any sugestion in this situation ? The menu should get on the background image. I have tried to do something with the background but it doesnt help.
Here is the pic of gap:
https://ibb.co/RcvM5nS
And here is the code:
.background {
background-color: #000000;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 650px;
width: 100%;
}
/*menu*/
#siteNav {
margin: 0 auto;
position: fixed;
width: 100%;
height: 50px;
box-sizing: border-box;
top: 0;
left: 0;
transition: 0.3s;
}
#siteNav.scroll {
background: rgba(0, 0, 0, 0.8);
height: 80px;
padding: 10px 80px;
}
#siteNav .logo {
padding: 10px;
height: 40px;
float: left;
transition: 0.3s;
}
#siteNav ul {
list-style: none;
float: right;
margin: 0;
padding: 0;
display: flex;
}
#siteNav ul li {
list-style: none;
}
#siteNav ul li a {
line-height: 50px;
padding: 6px 30px;
text-decoration: none;
transition: 0.3s;
color: #ffffff;
}
#siteNav.scroll ul li a {
color: #000000;
}
#siteNav ul li a:focus {
outline: none;
}
<nav id="siteNav">
<img class="logo" src="images/img2-logo.png" alt="">
<ul>
<li>MISSION</li>
<li>CLIENTS</li>
<li>PRODUCTS</li>
<li>CONTACT</li>
</ul>
</nav>
<!--header-->
<div class="background">
<header>
<div>
<h1><br><a></a></br>
</h1>
</div>
</header>
</div>

The problem is with h1 margin top. Remove that and it will work.
Also i suggest you use <header> tag as a first level tag which includes the nav.
Anyway, here's the solution.
I added margin:0 to body because here it has a default margin of 8px
.background {
background-color: #000000;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 650px;
width: 100%;
}
/*menu*/
#siteNav {
margin: 0 auto;
position: fixed;
width: 100%;
height: 50px;
box-sizing: border-box;
top: 0;
left: 0;
transition: 0.3s;
}
#siteNav.scroll {
background: rgba(0, 0, 0, 0.8);
height: 80px;
padding: 10px 80px;
}
#siteNav .logo {
padding: 10px;
height: 40px;
float: left;
transition: 0.3s;
}
#siteNav ul {
list-style: none;
float: right;
margin: 0;
padding: 0;
display: flex;
}
#siteNav ul li {
list-style: none;
}
#siteNav ul li a {
line-height: 50px;
padding: 6px 30px;
text-decoration: none;
transition: 0.3s;
color: #ffffff;
}
#siteNav.scroll ul li a {
color: #000000;
}
#siteNav ul li a:focus {
outline: none;
}
h1 {
margin-top:0;
}
body {
margin:0
}
<nav id="siteNav">
<img class="logo" src="images/img2-logo.png" alt="">
<ul>
<li>MISSION</li>
<li>CLIENTS</li>
<li>PRODUCTS</li>
<li>CONTACT</li>
</ul>
</nav>
<!--header-->
<div class="background">
<header>
<div>
<h1><br /><a></a>
</h1>
</div>
</header>
</div>

Soulution 1 :
Add padding: 6em 0 3em; to <div> below the <nav>
Soulution 2 :
Get rid of <h1>
The code snippet apply the first solution
.background {
background-image: url('https://via.placeholder.com/150');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 650px;
width: 100%;
padding: 6em 0 3em;
}
/*menu*/
#siteNav {
margin: 0 auto;
position: fixed;
width: 100%;
height: 50px;
box-sizing: border-box;
top: 0;
left: 0;
transition: 0.3s;
}
#siteNav.scroll {
background: rgba(0, 0, 0, 0.8);
height: 80px;
padding: 10px 80px;
}
#siteNav .logo {
padding: 10px;
height: 40px;
float: left;
transition: 0.3s;
}
#siteNav ul {
list-style: none;
float: right;
margin: 0;
padding: 0;
display: flex;
}
#siteNav ul li {
list-style: none;
}
#siteNav ul li a {
line-height: 50px;
padding: 6px 30px;
text-decoration: none;
transition: 0.3s;
color: #000000;
}
#siteNav.scroll ul li a {
color: #000000;
}
#siteNav ul li a:focus {
outline: none;
}
<nav id="siteNav">
<img class="logo" src="images/img2-logo.png" alt="">
<ul>
<li>MISSION</li>
<li>CLIENTS</li>
<li>PRODUCTS</li>
<li>CONTACT</li>
</ul>
</nav>
<!--header-->
<div class="background">
<header>
<div>
<h1><br><a></a></br>
</h1>
</div>
</header>
</div>

I think you have used <h1> tag in your HTML code and that is having default margins set in it. if you just handle that, it will resolve your problem.

Related

CSS vertical-centering with ul/li

I'm wondering why my id="subnavigation" won't center vertical, I was using top: xxpx; but since most monitors are different, I have to get it in the vertical center for every monitor.
I tried using:
justify-content: center
align-items: center
line-height: normal
vertical align-middle & also top: 50%,
but it won't move into the right spot, any recommendations ?
HTML:
<!DOCTYPE html>
<html>
<head>
<title>FootDiver!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style/style.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Shadows+Into+Light"
rel="stylesheet">
</head>
<body>
<header>
<nav id="mainnavigation">
<ul>
<li>Startseite</li>
<li>Über uns</li>
<li>Join Us!
<ul>
<li>LogIn</li>
<li>Registrierung</li>
</ul>
</li>
<li>Forum</li>
<li>FAQ</li>
<li>Newsletter</li>
</ul>
</nav>
</header>
<div id="subnavigation">
<nav id="sub">
<ul>
<li>Olympia</li>
<li>Beef&Beats</li>
<li>Gantero</li>
<li>La Roma</li>
<li>Wok Paradis</li>
</ul>
</nav>
</div>
<footer>
<nav id="foot">
<ul>
<li>Impressum</li>
<li>Datenschutz</li>
<li>AGB</li>
<li>Kontakt</li>
<li>Social Media</li>
<li>Intern</li>
</ul>
</nav>
</footer>
<div id="main">
<h1>Herzlich Wilkommen!</h1>
</div>
</body>
</html>
CSS: (from line 95 to 116)
body, html {
background: #F4A460;
margin: 0;
padding: 0;
font-size: 62.5%;
}
#media screen and (min-width: 1200px) {
html {
font-size: 63%;
}
}
header {
background: #8A4B08;
position: fixed;
top: 0;
width: 100%;
text-align: center;
transition: 200ms all;
height: 7rem;
}
header nav#normal {
color: #000000;
display: inline-block;
}
header nav#normal ul {
margin: 0;
padding: 0;
float: left;
list-style: none;
position: relative;
transition: all 300ms;
}
header nav#normal ul li {
margin: 0;
padding: 0;
float: left;
list-style: none;
position: relative;
transition: all 300ms;
}
header nav#normal ul li a {
display: inline-block;
padding: 2.17rem;
float: left;
min-width: 12rem;
text-align: center;
font-size: 2rem;
color: #000000;
margin: 0 1px 0 0;
text-decoration: none;
background: #deb887;
font-weight: 300;
transition: all 300ms;
font-family: 'Source Sans Pro', sans-serif;
}
header nav#normal ul li:hover > a {
background: #FFD39B;
}
header nav#normal ul li ul {
overflow: hidden;
position: absolute;
top: 100%;
left: 0;
width: 100%;
transition: 300ms all;
max-height: 0;
}
header nav#normal ul li:hover > ul {
max-height: 900px;
}
header nav#normal ul li ul li {
border-bottom: 1px solid #8A4B08;
}
div#subnavigation {
background: #8A4B08;
position: fixed;
top: 0;
width: 166px;
text-align: center;
transition: 200ms all;
height: 1200px;
}
div#subnavigation nav#sub {
display: inline-block;
}
div#subnavigation nav#sub ul {
margin: auto;
padding: 0;
float: left;
list-style: none;
position: relative;
top: 375px;
transition: all 300ms;
}
div#subnavigation nav#sub ul li {
margin: 0;
padding: 0;
float: left;
list-style: none;
position: relative;
transition: all 300ms;
}
div#subnavigation nav#sub ul li a {
display: inline-block;
padding: 2.17rem;
float: left;
min-width: 12rem;
text-align: center;
font-size: 2rem;
color: #000000;
margin: 0 1px 0 0;
text-decoration: none;
background: #deb887;
font-weight: 300;
transition: all 300ms;
font-family: 'Source Sans Pro', sans-serif;
border-bottom: 1px solid #8A4B08;
vertical-align: middle;
}
div#subnavigation nav#sub ul li:hover > a {
background: #FFD39B;
}
footer {
position: fixed;
right: 0;
bottom: 0;
left: 0;
height: 7rem;
background-color: #8A4B08;
text-align: center;
}
footer nav#foot {
color: #000000;
display: inline-block;
}
footer nav#foot ul {
margin: 0;
padding: 0;
float: left;
list-style: none;
position: relative;
transition: all 300ms;
}
footer nav#foot ul li {
margin: 0;
padding: 0;
float: left;
list-style: none;
position: relative;
transition: all 300ms;
}
footer nav#foot ul li a {
display: inline-block;
padding: 2.17rem;
float: left;
min-width: 12rem;
text-align: center;
font-size: 2rem;
color: #000000;
margin: 0 1px 0 0;
text-decoration: none;
background: #deb887;
font-weight: 300;
transition: all 300ms;
font-family: 'Source Sans Pro', sans-serif;
}
footer nav#foot ul li:hover > a {
background: #FFD39B;
}
div#main {
text-align: left;
margin-left: 25rem;
margin-top: 15rem;
}
div#main h1 {
font-size: 6rem;
font-family: 'Shadows Into Light', cursive;
}
Try adding
display: flex;
align-items: center;
to the parent of the element you want to center vertically. justify-content: center only works when you use flex
Example

HTML/CSS hover background image

I have a problem with putting an img for hover background.
It should look like this : Navigation
These 2 lines, represent the hover transparent image, and the text "home" should be in center of that img.. I have no idea how to do that... Anyone ?
Sorry if my english is bad
.page-container {
width: 980px;
margin: 0 auto;
text-align: center;
}
header {
margin: 0;
padding: 0;
width: 100%;
height: 220px;
background-color: #EAEAEA;
}
.logo {
text-align: center;
}
.logo img {
margin: 30px 0 0 0;
}
nav {
height: 136px;
}
ul {
list-style-type: none;
display: inline-block;
margin: 70px 0 0 0;
padding: 0;
}
nav li {
float: left;
text-align: center;
}
nav li a {
margin-right: 165px;
text-decoration: none;
float:left;
font-size: 22px;
letter-spacing: 3px;
text-transform: uppercase;
font-family: font91477;
color: #9E9E9E;
background-size: 75px;
}
a:focus {
text-decoration: none;
color: #9E9E9E;
}
a:hover {
height: 75px;
text-decoration: none;
color: #9E9E9E;
background: url(http://i.imgur.com/P5tF09r.png) no-repeat center;
}
<header>
<div class="logo">
<img src="img/logo.png"/>
</div>
<nav>
<div class="page-container">
<ul>
<li>Home</li>
<li>O Podjetju</li>
<li>Produkti</li>
<li><a class="last-child" href="#">Kontakti</a></li>
</ul>
</div>
</nav>
</header>
just add the following css styles
a:hover {
height: 75px;
text-decoration: none;
color: #9E9E9E;
background: url(http://i.imgur.com/P5tF09r.png) no-repeat center;
/*****************here they are ************/
display:flex;
align-items: center;
}
Why you don't make it in css ? Something like this
.menu{
list-style: none;
background-color: #EAEAEA;
margin: 0;
padding: 20px 0;
overflow: hidden;
}
.menu__item{
float: left;
margin: 0 20px;
position: relative;
}
.menu__item a{
background-color: #EAEAEA;
text-transform: uppercase;
position: relative;
z-index: 1;
}
.menu__item::after{
content:'';
width: 1px;
height: 1px;
background-color: #000;
position: absolute;
top: 50%;
left: 50%;
margin: 0;
transform: rotate(-45deg);
z-index: 0;
transition: all .25s ease;
}
.menu__item:hover::after{
width: 50px;
margin: -1px 0 0 -25px;
}
<ul class="menu">
<li class="menu__item"><a>Home</a></li>
<li class="menu__item"><a>test</a></li>
<li class="menu__item"><a>very long title for test</a></li>
<li class="menu__item"><a>test</a></li>
</ul>

Vertical-align: middle not working?

Why isn't the vertical-align: middle; not working on my h1? The ul isn't aligning with the h1 and it should.
#logo {
color: white;
display: inline;
vertical-align: middle;
}
ul {
padding: 20px;
background: rgba(0,0,0,.5);
}
#title {
position: absolute;
text-align: center;
color: white;
font-size: 50px;
top: 100px;
}
#navbar {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-image: url('../img/bg.jpg');
background-repeat: no-repeat;
background-size: 100% 100%;
height: 600px;
}
li {
float: right;
display: inline;
}
li a {
display: inline;
padding: 10px 10px 10px 20px;
text-decoration: none;
color: white;
}
<div id="navbar">
<ul>
<h1 id="logo">Jordan Baron</h1>
<li>About Me</li>
<li>Contact</li>
<li>Projects</li>
</ul>
<h1 id="title">Freelance Web Developer</h1>
</div>
Because vertical-align only applies to inline and table-cell elements, not block-level elements.
In order to have your links line up with your header, you need to assign a line-height equal to the height of the header element (35.33px):
li {
line-height: 35.33px;
}
#logo {
color: white;
display: inline;
vertical-align: middle;
}
ul {
padding: 20px;
background: rgba(0, 0, 0, .5);
}
#title {
position: absolute;
text-align: center;
color: white;
font-size: 50px;
top: 100px;
}
#navbar {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-image: url('../img/bg.jpg');
background-repeat: no-repeat;
background-size: 100% 100%;
height: 600px;
}
li {
float: right;
display: inline;
line-height: 35.33px;
}
li a {
display: inline;
padding: 10px 10px 10px 20px;
text-decoration: none;
color: white;
}
<div id="navbar">
<ul>
<h1 id="logo">Jordan Baron</h1>
<li>About Me</li>
<li>Contact</li>
<li>Projects</li>
</ul>
<h1 id="title">Freelance Web Developer</h1>
</div>
It's also worth noting that having a <h1> element as a child of <ul> is invalid syntax. Only <li> elements shouold be a child of <ul>. What you should do is bring the title out of the <ul>, and float the entire <ul> element to the right.
Hope this helps! :)
Ready for a bit of a mind flip?
Here comes FLEXBOX! This could be done "better" but I didn't want to change your html structure: https://jsfiddle.net/ohbffjjm/
#navbar {
background-color: pink;
}
#logo {
margin-right: 150px;
align-self: flex-start;
}
ul {
display: flex;
align-items: center;
list-style-type: none;
}
li a {
padding: 10px 10px 10px 20px;
text-decoration: none;
color: white;
}
<div id="navbar">
<ul>
<h1 id="logo">Jordan Baron</h1>
<li>About Me</li>
<li>Contact</li>
<li>Projects</li>
</ul>
</div>
And a flexbox solution with a few html improvements and improvisations.
body {
margin: 0;
}
header {
color: white;
background: rgba( 0, 0, 0, 0.5 );
}
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
header,
ul {
display: flex;
align-items: center;
justify-content: space-between;
}
h1,
h2 {
margin: 0.5rem 0;
}
h1 {
padding: 0 20px;
}
h2 {
text-align: center;
}
ul {
padding: 0 10px;
}
li {
padding: 10px;
}
li a {
color: white;
text-decoration: none;
transition: color 350ms ease-in-out;
}
li a:hover {
color: gold;
}
<header>
<h1 id="logo">Jordan Baron</h1>
<ul>
<li>About Me</li>
<li>Contact</li>
<li>Projects</li>
</ul>
</header>
<main>
<h2>Freelance Web Developer</h2>
</main>

Image covering links

I am stumped on the following. I just added a logo to a site and for some reason, my nav panel links that are to the right of the logo/image are now not clickable. It appears that the image is somehow over-taking them, but I do not see how. In the console/inspect it doesn't show the image over-taking them?
Does anyone see why this is happening?
.header {
margin: 0;
background-color: rgba(0,0,0,0);
height: 80px;
z-index: 9999;
position: absolute;/*test*/
width: 100%;
}
.header_wrap {
margin: 0 4%;
padding: 2% 0 0 0;
}
.logo {
position: absolute;
margin-top: -15px;
cursor: pointer;
}
.logo-img {
/*height: 75px;
width: auto;*/
height: auto;
width: 25%;
}
.logo a {
color: #000;
text-decoration: none;
}
.nav-list {
margin: 0;
list-style: none;
text-align: right;
width: 100%;
padding: 0;
}
.nav-list > a {
display: inline-block;
padding: 0px 15px;
text-decoration: none;
}
.nav-list > a > li {
text-decoration: none;
font-size: 1.2em;
color: #000;
}
.nav-list > a > li:hover {
color: #3f3f3f;
}
<header class="header">
<div class="header_wrap">
<div class="logo"><img src="http://optimumwebdesigns.com/images/LogoOpt2.png" class="logo-img" alt="Optimum Designs"></div>
<ul class="nav-list">
<li>WORK</li>
<li>APPROACH</li>
<li>SERVICES</li>
<li>PROJECT</li>
<li>CONTACT</li>
</ul>
</div>
</header>
I don't understood whay you have give position:absolute to logo but, add z-index: -1; to .logo will make your link clickable..
.header {
margin: 0;
background-color: rgba(0,0,0,0);
height: 80px;
z-index: 9999;
position: absolute;/*test*/
width: 100%;
}
.header_wrap {
margin: 0 4%;
padding: 2% 0 0 0;
}
.logo {
position: absolute;
margin-top: -15px;
cursor: pointer;
z-index: -1;
}
.logo-img {
/*height: 75px;
width: auto;*/
height: auto;
width: 25%;
}
.logo a {
color: #000;
text-decoration: none;
}
.nav-list {
margin: 0;
list-style: none;
text-align: right;
width: 100%;
padding: 0;
}
.nav-list > a {
display: inline-block;
padding: 0px 15px;
text-decoration: none;
}
.nav-list > a > li {
text-decoration: none;
font-size: 1.2em;
color: #000;
}
.nav-list > a > li:hover {
color: #3f3f3f;
}
<header class="header">
<div class="header_wrap">
<div class="logo"><img src="http://optimumwebdesigns.com/images/LogoOpt2.png" class="logo-img" alt="Optimum Designs"></div>
<ul class="nav-list">
<li>WORK</li>
<li>APPROACH</li>
<li>SERVICES</li>
<li>PROJECT</li>
<li>CONTACT</li>
</ul>
</div>
</header>
Edit:
Other solution is give display: block; to .logo a will work. Fiddle
The image is not overtaking them but the <div> the image is sitting in is. It's full width so you have a transparent div sitting on top of your navbar. Limit the width of your logo container, use a span instead or float it as suggestions.
Check that the z-index of the image is below the z-index of the links.
You don't really need to use position: absolute;. Instead use display:inline or inline-block and avoid overlapping.
You CSS would look like this:
.nav-list {
display:inline; /* Add this */
margin: 0;
/* width:100%; you can remove this */
list-style: none;
text-align: right;
padding: 0;
}
.logo {
display:inline; /* add this*/
margin-top: -15px;
cursor: pointer;
/* z-index: -1; no need for z-index */
}
JsFiddle

Unwanted padding on the bottom of div

I'm having trouble with the header div of this website I'm making. There is padding or something appearing underneath my horizontal menu bar even though my padding is set to 0. I know that similar posts have been made about the but I have read quite a few and none of the answers seemed to do the trick for me. I have changed the background of the header div to yellow to make it more visible. There is also a pixel or two on either side of the menu bar which are unwanted. I'll put my css and html code below. screenshot
<div class="big header">
<img src="Images/headerphoto.jpg" alt="header_photo">
<div class="navbar">
<ul>
<li><a class="active" href="default.asp">Home</a></li>
<li>Contact</li>
<li>About Us</li>
<ul class="logo">
<li><a class="logo" href="http://www.linkedin.com"><img alt="in" src="Images/linkedinlogo.png"></a></li>
<li><a class="logo" href="http://www.facebook.com"><img alt="fb" src="Images/facebooklogo.png"></a></li>
<li><a class="logo" href="http://www.twitter.com"><img alt="tw" src="Images/twitterlogo.png"></a></li>
<li><a class="logo" href="http://www.rss.com"><img alt="rs" src="Images/rsslogo.png"></a></li>
</ul>
</ul>
And here is the relevant CSS. (The 'Big' class is what I'm using for all the major elements on the page.)
body {
background-image:url("Images/background.png");
background:tile;
}
.header img {
width: 100%;
}
.header {
background-color: yellow;
height: auto;
padding-top: 30px;
padding-left: 0px;
padding-bottom: 0px;
margin-top: 10px;
}
.big {
width: 80%;
margin-left: auto;
margin-right: auto;
box-shadow: 0px 0px 20px #C5C5C5;
}
Here is the css for my navbar.
.button {
background-color: #3EB5F5;
border: none;
color: white;
transition: all 0.5s;
cursor: pointer;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '»';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.navbar {
width: 100%;
margin-top: 15px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}
.navbar ul {
list-style-type: none;
margin: 0px;
padding: 0;
overflow: hidden;
background-color: #828080;
height: 38px;
}
.navbar li {
float: left;
}
.navbar li a[href$=".asp"]{
display: block;
color: white;
text-align: center;
padding: 16px;
padding-bottom: 10px;
padding-top: 10px;
text-decoration: none;
height: 100%;
}
.navbar li a[href^="http"] {
padding-top: 6px;
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
}
.navbar li a:hover {
background-color: #111;
}
.logo img {
width: 25px;
}
.logo {
float:right;
list-style-type:none;
padding-bottom: 0px;
padding-top: 0px;
vertical-align: middle;
}
.active {
background-color: #106AAA
}
I have added an example to show http://codepen.io/simondavies/pen/jWjoBy
It working please check out the css, html etc
I have guestimated some stuff... Hope it will be a help
<div class="big header">
<div class="header-img"><img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=1000%C3%97150&w=1000&h=150" alt="header_photo"></div>
<div class="navbar">
<ul>
<li><a class="active" href="default.asp">Home</a></li>
<li>Contact</li>
<li>About Us</li>
<li><!--<ul class="logo"></ul>--></li>
</ul>
</div>
</div>
CSS
body {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.header {
background-color: yellow;
height: auto;
margin: 0;
padding: 0;
box-sizing: border-box;
}
.header-img{
width: 100%;
height: 150px;
padding: 30px 0 15px 0;
margin: 0;
}
.header-img img {
width: 100%;
height: 150px;
padding: 0;
margin: 0;
}
.big {
margin: 0 auto;
padding: 0;
margin-top: 10px;
width: 80%;
box-shadow: 0px 0px 20px #C5C5C5;
}
.button {
background-color: #3EB5F5;
border: none;
color: white;
transition: all 0.5s;
cursor: pointer;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '»';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.navbar {
width: 100%;
margin: 0;
padding: 0;
}
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #828080;
height: 38px;
}
.navbar li {
float: left;
}
.navbar li a[href$=".asp"] {
display: block;
color: white;
text-align: center;
padding: 16px;
padding-bottom: 10px;
padding-top: 10px;
text-decoration: none;
height: 100%;
}
.navbar li a[href^="http"] {
padding-top: 6px;
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
}
.navbar li a:hover {
background-color: #111;
}
.logo img {
width: 25px;
}
.logo {
float: right;
list-style-type: none;
padding-bottom: 0px;
padding-top: 0px;
vertical-align: middle;
}
.active {
background-color: #106AAA
}
You have an error in your HTML:
<ul>
<li><a class="active" href="default.asp">Home</a></li>
<li>Contact</li>
<li>About Us</li>
<ul class="logo">
The only descendants of either <ul> or <ol> should be <li>. It is possible that this could be the issue.
I corrected the markup in two ways, without reproducing your issue:
By wrapping <ul class="logo"> inside of an <li> (essentially assuming it was a sublist in your list
By closing your first <ul>, and then letting the second list sit adjacent to it
But I also could not reproduce your issue by leaving the markup alone
So, the issue may be:
You need to use a CSS reset to remove default margins and paddings that the browser is providing
There is another ruleset that is adding padding to your .header
That other ruleset may have a higher specificity
That other ruleset may have an !important declaration