Good Day.
I have a rather weird problem. And it is the first time I came across this.
I have an html/css menu (navigation menu) consisting of a ul list and anchor tags inside.
I am using border-bottom to highlight the menu on hover...
Now issue: I have 2 PC's on which I work - Both windows 7, different editions. Now in chrome and firefox, the menu shows fine. Also, I am using an IE only stylesheet to fix an alignment issue in IE. Look at Image1 to see my menu in the above mentioned browsers...
Now on my employer's PC(Windows 8) and on one of my colleagues PC's, also windows 8, the list items are shifted downwards - In Chrome. Also in IE(did not test in FF) - See Image2.
Why would the css display fine on my Chrome browsers but not on theirs. Everthing else on the pages displays fine between the browsers.
See my CSS defining the menu:
/THE CSS FOR THE MENU's PARENT divs/
#wrapper {
margin: 0 auto;
margin: 20px auto;
text-align: center;
width: 960px;
background: #f5f5f5; /*url('/images/bgMain.png') repeat center;*/
-moz-box-shadow:0 0 5px #999;
-webkit-box-shadow:0 0 5px #999;
box-shadow:0 0 5px #999;
}
#header {
margin: 0 auto;
/*background: url('/images/bg2.png') repeat-x center;*/
background: #eee;
text-align: center;
border-bottom: 6px solid #f3911f;
}
/**********************HERE THE MENU CSS STARTS***************/
#menuNav {
height: 100px;
text-align: center;
margin: 0 auto;
}
#menuNav ul {
list-style: none;
}
#menuNav ul li {
display: inline-block;
height: 100px;
line-height: 178px;
}
#menuNav ul li a {
padding: 0px 15px ;
font-family: 'Myriad Pro', 'Open Sans', Arial, sans-serif;
font-size: 22px;
color: #3c3b3d;
text-transform: uppercase;
border-bottom: 6px solid #f3911f;
text-decoration: none;
}
#menuNav ul li a.menuSmaller {
font-size: 18px;
padding-bottom: 2px;
}
#menuNav ul li a:hover {
border-bottom: 6px solid #7f2218;
}
#menuNav ul li a:focus {
border-bottom: 6px solid #7f2218;
}
/*LOGIN*/
#menuNav ul li#login, #menuNav ul li#logout{
float: right;
margin: 0px;
}
#menuNav ul li#login a, #menuNav ul li#logout a {
color: #7f2218;
}
/*Show hover effect on selected/active menu*/
.activeMenu {
border-bottom: 6px solid #7f2218 !important;
}
HTML:
<div id="wrapper" class="row-fluid">
<div id="header" class="row-fluid">
<div id="logo" class="span2">
<div><img src="images/logo.png" alt="CardVault Logo" /></div>
</div>
<div id="menuNav" class="span10">
<ul>
<li id="menuSignUp">Sign Up</li>
<li id="menuPricing">Pricing</li>
<li id="menuCorporate">Corporate</li>
<li id="menuAbout">About</li>
<li id="menuPartners">Partners</li>
<li id="login">Login</li>
</ul>
</div>
</div>
</div>
NOTE: I am using twitter bootstrap for the main layout, but I donlt think that that can cause any issues, it has never before...
Also, we both have the latest Chrome version...
Thank you!
The only times I have seen this happen was between different operating systems as well. In that case, it worked on Windows and Linux but not on Mac. The only common trait between the various occurrences was that the rendered menu font appeared different. And, yes, it cause me some headaches too.
You may also want to reset the page zoom by doing CTRL-0 just in case someone zoomed in and that screwing things up.
What did work is to adjust the padding of menu items until the one incorrect showed up properly and that reached both. Unfortunately, I could only do it by trial and error since the system in question did not have access to the development server.
Related
built a simple no-dropdown horizontal nav for a new site design and its all working fine like normal except that between 2 buttons is a phantom white space that doesn't appear in dragonfly's metrics, or in the code, but is visible on the screen when the li's hover rule applies. and it does not appear between each li, just between 2 specific lis. i have attached images below showing what i mean:
no problem, everything looks as it should:
on the right side of the hovered li is a px of whitespace that shouldnt be there:
.navi {
display: inline-block;
height: 50px;
max-height: 50px;
overflow: hidden;
list-style: none;
float: right;
}
.navi li {
float: left;
}
.navi li a {
padding: 16px;
border-left: 1px solid #8bd854;
font-size: 16px;
text-decoration: none;
line-height: 50px;
color: #8c8c8c;
transition: all 0.5s ease;
}
.navi li a:hover {
background-color: rgba(13, 137, 0, 0.61);
text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.57);
color: #fff;
}
<ul class="navi">
<li>Home</li>
<li>About</li>
<li>Lawn Care</li>
<li>Tree & Shrub Removal</li>
<li>Contact</li>
</ul>
any idea where this may be coming from? It's not a huge deal if not Solvable but it is an annoyance.
Thanks in advance
An easy way to fix this is by using the font-size:
.navi {
font-size: 0;
}
.navi li {
font-size: 1rem;
}
This sets the font size of the list to zero and the font size of the list element to the size of the root element (you may use any other unit – except em – if you want to).
I'm not entirely sure what is causing this. Maybe it's webkit or some nuance of CSS, but at least in this one particular case, you can add display:block to .navi li a and change padding: 16px to padding: 0 16px on that same rule. Unfortunately I can't figure out why this works but my best guess is that whitespace is causing the issue.
I was able to reproduce the issue in Chrome by setting the zoom to 110%. Perhaps, you could set the zoom of all the navigation elements and their children to be zoom: 1.0;.
It is probably just whitespace. try
<ul class="navi"
><li>Home</li
><li>About</li
...
></ul>
I am trying to make my navbar look good on mobile devices and for it to be responsive. However, it looks horrible right now via mobile and all mushed together. Is there anyway I could make this look any better without making the links crazy small?
Please look at it via mobile at a page I made up for everyone to see on here..
sundayfundayleague.com/show_nav.php
For some reason in the page I created, all of these links are not showing up in the navbar..
<li>
Draft Selection
</li>
</ul>
</div>
<div class="nav_right">
<ul>
<li>
<?php echo escape($user->data()->username); ?>
</li>
<li>
Messages
</li>
<li>
Admin
</li>
<li>
Log Out
</li>
</ul>
</div>
Usually it will just compress all of the links and it looks awful.
What can I do to make all the things show up and for it to look good?
This is my media query for the header/navbar...
.spectator_header {
position: relative;
height: 200px;
}
.spectator_nav {
height: 75px;
background-color: #800000;
left: 2%;
display: inline;
bottom: 0;
position: absolute;
width: 95%;
font-size: .7em;
font-style: Helvetica;
-moz-border-radius: 0px;
-webkit-border-radius: 15px 15px 0px 0px;
border-radius: 15px 15px 0px 0px;
-webkit-box-shadow: 0px 0px 16px #C0C0C0;
-moz-box-shadow: 0px 0px 16px #C0C0C0;
box-shadow: 0px 0px 16px #C0C0C0;
}
.spectator_nav li a {
text-decoration: none;
display: block;
}
.spectator_nav li:hover ul {
display: block;
}
.spectator_nav ul {
padding: 0px;
}
.spectator_nav li {
position: relative;
float: left;
list-style-type: none;
padding: 25px 4px;
}
.spectator_nav li:first-child {
margin-left: 5px;
}
.spectator_nav li:last-child {
margin-right: 5px;
}
.spectator_nav ul:after {
content: ".";
display: block;
height: 0px;
clear: both;
visibility: hidden;
}
Mobile nav can be very tricky and there are lots of ways to approach it. I'd recommend looking at some resources like This Is Responsive or CSS-Tricks to get some ideas on how to tackle this. There are lots of options so find one that works for you.
The reason not all the links are showing is because the last one is breaking to a new line. Since the container has a fixed height of 75px and there's so much padding around the <li>s you can't see the link on the second line. That's part of why mobile nav is tricky, when you have too many links to comfortably fit on a horizontal line you have to decide how to handle it.
Do you want to your nav to grow to multiple lines, or switch to a hamburger or select menu? Do you want to just cram all the links on a single line no matter what? Do you need to allow for adding more nav links or changing the font size or weight in the future? This would add length to the nav list and affect the approach you want to take. If you have more info I can point you to a good solution, but if your question is simply "how do I make this responsive?" then you need to ask more questions first.
I'm fairly new to HTML/CSS coding, but I'm currently learning and developing a website. However, I'm sort of stuck on the process of my navigation bar. I managed to get a navigation bar to work, a horizontal one, with a working background image. The one thing I do have trouble with is having my navigation bar have drop down menus, like this: http://maxcdn.webappers.com/img/2008/10/free-css-drop-down-menu.png. Except without the extra sub-menus. Here's what I have so far:
HTML:
<div id="menu">
<ul>
<li>home</li>
<li>blank</li>
<li>about</li>
<li>site</li>
<li>contact</li>
</ul>
</div>
<div style="z-index:0;left:0;top:0;width:100%;height:100%">
<img src="unknown.jpg" style='width:100%;height:100%'/>
</div>
CSS:
#menu {
width: auto;
height: auto;
font-size: 16px;
font-family: Tahoma, Geneva, sans-serif;
font-weight: bold;
text-align: center;
text-shadow: 3px 2px 3px #333333;
background-color: #8AD9FF;
border-radius: 8px;
}
#menu ul {
height: auto;
padding: 8px 0px;
margin: 0px;
display: inline;
}
#menu li {
display: inline;
padding: 20px;
}
#menu a {
text-decoration: none;
color: #00F;
padding: 8px 8px 8px 8px;
}
#menu a:hover {
color: #F90;
background-color: #FFF;
}
Sorry if the question is relatively easy to answer, but I'm having trouble. I'm not sure how to change my HTML code into a code where visitors can hover their mouse over, for example, contact and they'll have the option to pick either Administrator or Other. Thank you.
You'll need to define the onmouseover event of the relevant elements and then, using some Javascript, append new elements somewhere in your menu div (or trigger their visibility). Not the easiest thing to start with for a beginner !
Ok this is simple thing. I firstly created a usual "Home" Button linking to the Home Page of the website, but the word "Home" looked too obvious. Hence I tried to insert an icon in place of that word, but its not fitting properly. I have tried some things in my css but its messing up the whole (used to create the navigation menu). The screenshot is attached. Please if someone can see whats wrong.
CSS:-
ul#menu
{
padding: 0px;
position: relative;
margin: 0;
}
ul#menu li
{
display: inline;
text-decoration:solid;
}
ul#menu li a
{
color: black;
background-color: #f5b45a;
padding: 10px 20px;
text-decoration: none;
line-height: 2.8em;
/*CSS3 properties*/
border-radius: 4px 4px 0 0;
}
HTML:-
<ul id="menu">
<li id="Home_Link"><img src="../../Image_Data/Home_Icon.ico" id="Home_Icon"/></li>
<li>MEN</li>
<li>WOMEN</li>
<li>KIDS</li>
<li>DESIGN!!</li>
With your current styles you will need to play around with the vertical-alignment and margins for the image, something like:
ul#menu li#Home_Link a img {
vertical-align: text-bottom;
margin-bottom: -5px;
}
As a side note, your use of ID's for elements is not recommended - use classes if needed. And reduce the specificity of your style declarations, e.g. .home-link img
How can I change the menu color when the page is selected?
Example:
home faq contact_us
I want to show which page is selected in the menu bar. I'm using CSS but not sure how to go about this.
My CSS code:
.menu {
float: left;
margin: 0px 0 0 0;
width: 1000px;
}
.menu li {
border-left: 1px solid #fff;
float: left;
line-height: 1em;
text-align: center;} .menu li a { color: #fff;
display: block;
font: 17px Arial, Helvetica, sans-serif;
padding: 0px 31px;
line-height:47px;
text-decoration: none;
}
.menu li a span {display:block; padding:0px 15px;}
.menu li a:hover, .menu .active a{color:#fff;
background:#ed1f26 url(images/menuleft.jpg) left top no-repeat;
width:auto;
}
.menu li a:hover span, .menu .active a span
{background: url(images/menuright.jpg) right top no-repeat;
padding:0px 14px;
border:1px solid #b3c302;
}
Well, if you're writing the menu to each page (as seems to be the case from your comments) there's nothing stopping you from changing the background colour for the specific <li> related to that page.
Example below showing white background for current page (Home) or default colour for non-active pages.
<li style="background-color:rgb(255,255,255);">Home</li>
<li>FAQ</li>
<li>Contact Us</li>
Alternatively you could use some script and create tabs like I have done in this fiddle: http://jsfiddle.net/gstubbenhagen/zAbmA/
I would only recommend the tabs if you don't have too much content on each page as you don't want to make 1 very large page which takes forever to load on slower connections.
NOTE: If using the tabs option the example provided uses a JQuery plugin, make sure you add the same tools if you are not going to re-code.