Spaces between Menu items acting like invisible text - css

A few weeks ago I was asked by my church to create a new website for them which I happily obliged to. I've already created a mockup in PS and I'm coding it right now. I created the navigation bar and it is working properly as I had intended.
However I'm running into a glaring problem concerning the spaces in between the menu items. It seems like it may be an easy fix, but I cannot seem to figure it out. The menu bar is set up as unordered and ordered lists. I have them evenly spread out, but in between the empty spaces, the mouse cursor changes from a pointer into an "I" bar, as if there is invisible text.
For me, this is not ideal, and I'd much prefer that when hovering over this empty space between the menu items that it would stay as a pointer for the cursor instead of this "I" bar. Also, if you highlight the entire menue, the spaces also highlight as well and connect with the menu items. That is also not ideal for me, and it makes me confused why the empty spaces are sort of acting like invisible text.
Here is my menu bar CSS code:
<style type="text/css">
nav {
position: relative;
width:960px;
z-index:9999;
margin-left:auto;
margin-right:auto;
padding:0;
background-color:transparent;
text-align:justify;
}
#bar1 {
background-color:transparent;
padding:0;
text-align: justify;
overflow: hidden;
height:39px;
border-top: 1px solid #222222; border-bottom: 1px solid #90908e;
background-color:transparent;
}
#bar1>li {
display:inline-block;
margin-top:8px;
height:100%;
background-color:transparent;
}
#bar1>li>a {
font-family:'Oswald',Verdana, Geneva, sans-serif;
font-size:15px;
color:#464748;
text-decoration:none;
}
#bar1>li>a:hover,#bar1>li>a:active,#bar1>li:hover>a {
font-family:'Oswald',Verdana, Geneva, sans-serif;
font-size:15px;
color:#2b77a0;
text-decoration:none;
}
#bar1>li>ul>li {
border-top: none;
height:33px;
margin-top:8px;
left: 0;
position: absolute;
width: 100%;
text-decoration:none;
background-color:transparent;
padding-top:7px;
}
#bar1>li:hover>ul>li{
display:block;
}
#bar1>li>ul>li{
display:none;
text-decoration:none;
}
#bar1>li>ul>li>a
{
font-family:'Antenna Thin', Arial, Helvetica, sans-serif;
font-size:15px;
color:#222222;
text-decoration:none;
}
#bar1>li>ul>li>a:hover, #bar1>li>ul>li>a:active, #bar1>li>ul>li:hover>a,
{
font-family:'Antenna Thin', Arial, Helvetica, sans-serif;
color:#222222;
}
li {
list-style-type:none;
}
.filler
{
width:100%;
display: inline-block;
height:0px;
cursor:pointer;
}
</style>
And here is my HTML coding (Ignore the comments, I use them so I don't get lost when I take breaks):
<nav>
<ul id="bar1">
<!--Begin About Us-->
<li>ABOUT US
<!--Begin drop down menu items-->
<ul>
<li>
<font color="#2b77a0">•</font> New to Nederland First Assembly
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Our History</span>
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Our Beliefs</span>
</li>
</ul>
<!--End drop down menu items-->
</li>
<!--End About Us-->
<!--Begin Ministries-->
<li>MINISTRIES
<!--Begin drop down menu items-->
<ul>
<li>
<font color="#2b77a0">•</font> Kids
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Youth</span>
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Women</span>
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Men</span>
</li>
</ul>
<!--End drop down menu items-->
</li>
<!--End Ministries-->
<!--Begin Events-->
<li>EVENTS
<!--Begin drop down menu items-->
<ul>
<li>
<font color="#2b77a0">•</font> Latest News
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Monthly Calendar</span>
</li>
</ul>
<!--End drop down menu items-->
</li>
<!--End Events-->
<!--Begin Listen Online-->
<li>LISTEN ONLINE
<!--Begin drop down menu items-->
<ul style="background-color:red;">
<li>
<font color="#2b77a0">•</font> Sermons
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Teachings</span>
<span style="margin-left:10px;"><font color="#2b77a0">•</font> Archive</span>
</li>
</ul>
<!--End drop down menu items-->
</li>
<!--End Listen Online-->
<li>CONTACT US</li>
<li class="filler"></li>
</ul>
And here is hopefully a working JS Fiddle:
http://jsfiddle.net/Broli/yemze0je/1/

Inline block assigns a font size based on the default, what you want is the hand icon on a link, and the arrow when it's not a link:
DEMO: http://jsfiddle.net/yemze0je/3/
nav {
position: relative;
width:960px;
z-index:9999;
margin-left:auto;
margin-right:auto;
padding:0;
background-color:transparent;
text-align:justify;
font-size:0px; /* due to inline-block on children */
}
Because your font size is specified in the children, this does just that.

First off, comments are good for you! :-)
My immediate thought looking at your HTML is that you should be wrapping each anchor within its own list item.
Change this and the markup will probably behave in the way that you would like it to.
http://www.w3schools.com/html/html_lists.asp
Alternatively, if you would like to keep the same markup, you could mask the issue by setting the cursor with CSS, like this;
ul, li{cursor: default;}
I am presuming that the li or ul will need the curser set (I'm on my smartphone!)

Related

drop down menu css not working, inner div not displaying

When hovering over Choose Location the div adv_cities should be displayed and i can navigate the adv_cities menu. What i've tried isn't working.
<div class="header_top_location"> <ul id="city_nav" class="city_nav menu">
<li class="mega">Choose Location
<div class="adv_cities" id="adv_cities" style="display:none">
<ul><li>London</li>
<li>Bristol</li>
<li>Manchester</li>
<li>Kent</li>
</ul>
</div>
</li>
</ul>
</div>
The CSS
.header_top_location .mega > a:hover + .adv_cities, .header_top_location .adv_cities:hover .adv_cities{
display:block !important;
}
.header_top_location .adv_cities {
background-color:#fff
}
.header_top_location .adv_cities ul{
overflow:hidden;
}
.header_top_location .adv_cities li{
float:left;padding:10px;
}
How do i solve this?
The city_nav code is from a plugin and i use on multiple pages, so i don't want to change the code since i use in multiple places.
If all you want on your drop down menu is to hover over one list iten to display the submenu, then you dont necessarily need the inner div and stuff... here is a code snippet for you to work with...
.mega:hover > .adv_cities {
display: block !important;
}
.header_top_location .adv_cities {
background-color: #fff
}
.header_top_location .adv_cities ul {
overflow: hidden;
}
.header_top_location .adv_cities li {
float: left;
padding: 10px;
}
<div class="header_top_location">
<ul id="city_nav" class="city_nav menu">
<li class="mega">Choose Location
<div class="adv_cities" id="adv_cities" style="display:none">
<ul>
<li>London</li>
<li>Bristol</li>
<li>Manchester</li>
<li>Kent</li>
</ul>
</div>
</li>
</ul>
</div>
The only changes I made in css are in the 1st 3 lines... and I removed the extra div that IMO was not needed..
hope this helps

How do I make a Flat Design Menu bar?

Hello I am trying to make a website but my menu bar is not doing what it should. This is what it should look like:
http://i.stack.imgur.com/KDvwo.png
But instead it looks like this:
http://i.stack.imgur.com/Y1Ya8.png
Here is my code:
HTML
<div class="wrapper">
<header>
<h1>Colve</h1></div>
<nav>
<ul class="menu1">
<li><a class="button" href="#">Home</a></li>
<li><a class="button" href="#about">About</a></li>
<li><a class="button" href="#downloads">Downloads</a>
<li><a class="button" href="invasion.html">INVASION</a></li>
</li><li><a class="button" href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<section id="about">
<h1>About-Colve</h1>
<p>Colve is a company that gives you the things you want in one place</p>
<p>Created by Bradley Beeke</p>
</section>
</div>
CSS
html {
font:12pt Lato, sans-serif;
min-height:100%;
background-image:linear-gradient(45deg,#3498db,#2ecc71);
}
body{margin:0px;}
header{
background-color:white;
Color: #FFDF00;
float:left;
padding-left:5px;
display:block;
}
nav {
background-color:white;
float:right;
padding-right:5px;
height:60px;
display:block;
width:100%;
float:right;
}
nav a {
text-decoration:none;
list-style:none;
color:#FFDF00;
font-size:20px;
padding:8px;
}
nav li:hover, a:hover {color:#998100;}
li{display:inline;}
section { margin-bottom: 1000px; padding-top: 150px; float: left; }
Please can you help me!
Working DEMO
<div class="wrapper">
<header>
<h1>Colve</h1> <!-- remove the </div> present here -->
<nav>
<ul class="menu1">
<li><a class="button" href="#">Home</a></li>
<li><a class="button" href="#about">About</a></li>
<li><a class="button" href="#downloads">Downloads</a>
<li><a class="button" href="invasion.html">INVASION</a></li>
</li><li><a class="button" href="contact.html">Contact</a></li>
</ul>
</nav>
In the nav css, make width to be auto
nav {
background-color:white;
float:right;
padding-right:5px;
height:60px;
display:block;
width:auto;
float:right;
}
Add width: 100%; in header {} because currently the header is not properly aligned.
The HTML is not well constructed. Please remove the extra and from the code.
Well, right off the bat your HTML is invalid.. I see two immediate problems.
First, the closing tag after your closing H1 tag cannot be there (it looks like that was just an accident anyway).
<div class="wrapper">
<header>
<h1>Colve</h1></div>
Second, the closing that starts this line doesn't make any sense.. Remove it.
</li><li><a class="button" href="contact.html">Contact</a></li>
Oh, I lied.. there's a 3rd.. There's no closing tag for this element.
<li><a class="button" href="#downloads">Downloads</a>
Other than that, your HTML looks fine to me at a quick look, but in the future you may want to bookmark this site:
http://validator.w3.org/#validate_by_input
After you correct those problems with your HTML, update your question if you're still having problems.

Horizontal list not going inline / in one line

I'm trying to make a horizontal list where each of the <li>s in the list have a height of 385px and a width of 400px.
I tried making the list horizontal by using inline-block, but that doesn't seem to be working.
By which, I mean the list is still vertical. The <li>s are the right size, but the list is not horizontal.
How can I make this list horizontal? (Preferably without flexbox)
Here is my CSS:
html, body{
margin:0;
padding:0;
font-family:'Open Sans', sans-serif;
font-size:16px;
}
#slides{
list-style:none;
list-style-type:none;
}
#slides li{
height:385px;
width:400px;
display:inline-block;
}
and my HTML:
<form action="" method="get">
<fieldset>
<ul id="slides">
<div id="first">
<li>
1
</li>
</div>
<div id="second">
<li>
2
</li>
</div>
<div id="last">
<li>
3
</li>
</div>
</ul>
</fieldset>
</form>
You are making it totally wrong, you are using div which are block level element, also you cannot use any other element except li inside ul, so your markup is invalid, instead do it like this
<ul>
<li><div>A</div></li>
<li><div>B</div></li>
</ul>
<style>
ul li {
display: inline-block;
}
</style>
Add a float:left to #slides li
#slides li{float:left;}
Hope this helps.
Remove the divs and float the lis to the left:
HTML
<form action="" method="get">
<fieldset>
<ul id="slides">
<li id="first">1</li>
<li id="second">2</li>
<li id="third">3</li>
</ul>
</fieldset>
</form>
CSS
html, body{
margin:0;
padding:0;
font-family:'Open Sans', sans-serif;
font-size:16px;
}
#slides{
list-style:none;
list-style-type:none;
}
#slides li{
height:385px;
width:40px;
display:inline-block;
float: left;
}
http://jsfiddle.net/X6LkZ/1/

how to make a drop down menu fixed from the top with css?

I want to make a drop menu like the one in http://www.homeshop18.com/ with css only without jquery in particular the All category menu.I have tried css drop down menu but the problem is i am unable to fix the second level menu at the top. any suggestion will be appreciated.
Can't understand what you problem is from the way you posted the question but here is a quick menu I put together that only uses CSS that functions like the menu on the site you posted.
HTML:
<ul class="main">
<li>all
<ul class="sub">
<li>books
<ul class="sub2">
<li>fiction</li>
<li>biography</li>
</ul>
</li>
<li>mobile
<ul class="sub2">
<li>android</li>
<li>cmda</li>
<li>battery</li>
</ul>
</li>
</ul>
</li>
</ul>​
CSS:
li {
border:1px solid;
padding:1px;
}
.main {
list-style:none;
position:relative;
}
.sub, .sub2 {
list-style:none;
position:absolute;
display:none;
width:75px;
}
.sub2 {
float:left;
left:75px;
top:0px;
}
.main li:hover .sub,
.sub li:hover .sub2{
display:block;
}

css expandable menu working fine in firefox, but not ie...sub li's not showing up properly

I've got an expandable css menu that is acting a bit weird in ie, but works fine in firefox. Anyone who can help me is appreciated.
Heres the problem. When I click the li it expands to the sub li fine, however, if I keep the mouse directly over the li I just clicked on, the text in the sub li's don't show. See this picture...notice where the mouse is located, and notice there is no text next to the sub li's. The anchor tag is represented by the dotted line.
If I move the mouse to the right (or anywhere off of the text "Los Angeles") the sub li's show up.
Notice the mouse now and the li's showing up in this picture:
Heres the css and html:
<HTML lang="en_US" sizcache="7062" sizset="0">
<HEAD>
<STYLE>
ul.left_menu{
position:relative;
float:left;
width:100%;
}
ul.left_menu li>a:hover{
cursor: pointer;
}
ul.left_menu li {
list-style-type:none;
position:relative;
padding-top: 5px;
clear:both;
}
ul#nav{
text-indent:15px;
}
#nav li > ul{
display:none;
padding-left:15px;
text-indent:15px;
}
#nav li {
line-height:11px;
}
#nav > li{
clear: both;
padding-left:15px;
line-height:11px;
}
A {
TEXT-ALIGN: left;
TEXT-DECORATION: none;
outline: none
}
</STYLE>
</HEAD>
<BODY>
<UL id="nav" class="left_menu">
<LI>
<A >Los Angeles</A>
<UL>
<LI>
<A>Commercial Properties</A>
<UL>
<LI>
<A>Office</A>
</LI>
<LI>
<A>Industrial</A>
</LI>
<LI>
<A>Retail</A>
</LI>
</UL>
</LI>
</ul>
</li>
</ul>
</body>
</html>
Thanks for your help.
This is called the Peek-a-boo bug. Here is an explanation of the bug and a fix:
http://www.positioniseverything.net/explorer/peekaboo.html

Resources