I'm having a problem with a nav bar in my site. It works in chrome, but something weird happens in firefox and I have no idea what it is...
In Firefox, the dark bar menu background doesn't show. It is transparent for some reason:
In Chrome is works as expected:
My sites wrapper has opacity 0.9, but I don't think this has anything to do with the menu not showing, since it shows on chrome...
Here is the HTML and CSS for my header: http://jsfiddle.net/Xdc9F/
HTML:
<div class="header">
<header>
<h1>
<a href="#">
<img src="http://i.imgur.com/z3Y7cmW.png" alt="" />
</a>
</h1>
</header>
</div>
<!-- closing header -->
<div class="menu">
<ul>
<li class="active"><span>Home</span>
</li>
<li><span>Sobre Nós</span>
</li>
<li><span>Localização</span>
</li>
<li><span>Contato</span>
</li>
</ul>
</div>
CSS:
.menu, .menu ul, .menu ul li, .menu ul li a {
padding: 0;
margin: 0;
line-height: 1;
font-family:'Capriola', sans-serif;
}
.menu:before, .menu:after, .menu > ul:before, .menu > ul:after {
content:'';
display: table;
}
.menu:after, .menu > ul:after {
clear: both;
}
.menu {
zoom:1;
height: 69px;
background: url(http://i.imgur.com/XnKK9WL.png) repeat-x center bottom;
margin-top: 100px;
border-radius: 2px;
}
.menu ul {
background: url(http://i.imgur.com/elYFBsn.png) repeat-x 0px 4px;
opacity: 1;
height: 69px;
}
.menu ul li {
float: left;
list-style: none;
}
.menu ul li a {
display: block;
height: 37px;
padding: 22px 30px 0;
margin: 4px 2px 0;
border-radius: 2px 2px 0 0;
text-decoration: none;
font-size: 15px;
color: white;
text-shadow: 0 1px 1px rgba(0, 0, 0, .75);
font-weight: 400;
opacity: .9;
}
.menu ul li:first-child a {
margin: 4px 2px 0 0;
}
.menu ul li a:hover, .menu ul li.active a {
background: url(http://i.imgur.com/jCkWOJx.png) center bottom;
display: block;
height: 37px;
margin-top: 0px;
padding-top: 26px;
color: #004f7c;
text-shadow: 0 1px 1px rgba(255, 255, 255, .55);
opacity: 1;
text-transform: uppercase;
}
I just pasted the header section, if you need the whole page code just tell me.
Everything works great for me. Probably you have done something wrong with the rest html or CSS.
The blue border is because of this rule:
background: url("http://i.imgur.com/XnKK9WL.png") repeat-x scroll center bottom transparent;
If you delete there isn't blue border
Related
I'm creating a website using Zurb's Foundation Framework for the first time , and I love it so far but I'm stuck on this one annoying thing! I'm not sure if I'm missing something obvious or not but I'd love it if you could help me!
Basically, in the desktop version, I have several social media icons that display above the top bar navigation, aligned one after the other horizontally. In the mobile version, I've hidden the top set of social media icons, and revealed a second set below the list of more important navigation items so that they aren't popping up first in the menu drop-down. This all works fine, my problem is that since the social media icons are all very small, I'd like them all to be in one row, horizontally aligned like in the desktop version, but I can only get them to display vertically.
I've tried having them in a single < li > element, and I tried using nonbreakable spaces, but neither thing worked. Does anyone have any idea how to fix it?
By the way here is the website I'm working on: http://cakebattermusic.com
Just to be clear, here is how I want it to pop up: (assume F, T, I are facebook twitter instagram)
HOME
CONTACT
WHATEVER
F T I
Here is how it pops up now:
HOME
CONTACT
WHATEVER
F
T
I
Is it possible to maybe list LI elements horizontally in only PART of a list and not the whole list? That would solve the problem but I haven't been able to figure out how to do that or if it's possible.
Here's the html:
<!-- /////////////////////// HEADER ////////////////// -->
<!-- HEADER SECTION -->
<div class="contain-to-grid header-section">
<!-- TOPBAR SECTION -->
<nav class="top-bar important-class" data-topbar>
<!-- TITLE AREA & LOGO -->
<ul class="title-area">
<li class="name">
<img src="img/logo.jpg" width="100px" alt="" id="logo-image">
</li>
<li class="toggle-topbar menu-icon"><span>menu</span></li>
</ul> <!-- END TITLE AREA & LOGO -->
<!-- MENU ITEMS -->
<section class="top-bar-section">
<ul class="right">
<div id="hidden"> <!-- hidden in mobile view -->
<li><img src="img/facebook.00_png_srz" border="0"></li>
<li><img src="img/twitter.00_png_srz" border="0"></li>
<li><img src="img/instagram.00_png_srz" border="0"></li>
<li><img src="img/tumblr.gif" border="0" width="20px"></li>
</div>
</ul>
<br>
<ul class="right">
<li>HOME</li>
<li>BIO</li>
<li>MUSIC</li>
<li>VIDEOS</li>
<li>TOUR</li>
<li>CONTACT</li>
<div id="hidden2"> <!-- hidden in desktop view -->
<li><img src="img/facebook.00_png_srz" border="0">
<img src="img/twitter.00_png_srz" border="0">
<img src="img/instagram.00_png_srz" border="0">
<img src="img/tumblr.gif" border="0" width="20px"></li>
</div>
</ul>
<br>
</section> <!-- END MENU ITEMS -->
Header CSS:
/*
HEADER SECTION
========================================================================== */
.header-section {
-webkit-box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4);
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4);
position: fixed;
z-index: 999;
min-width: 100%; }
.contain-to-grid {
background-color: #fff;
}
.header-fill {
background: #fff;
height: 120px; }
.header-fill .tablet-mobile-logo img {
padding-top: 30px; }
.padding-on-my-header {
padding: 17px 0.9375rem 62px 0.9375rem; }
.padding-on-my-header ul.title-area img {
margin: -5px 0 0 0; }
.full-width {
min-width: 100%; }
p {
line-height: 3rem;
padding-bottom: 30px; }
/*
TOPBAR NAVGATION
========================================================================== */
.top-bar {
background: #fff;
padding: 20px 0.9375rem 90px 0.9375rem;
transition: all 0.5s ease 0.1s; }
.top-bar ul.title-area img {
margin: -10px 0 0 0; }
.top-bar .top-bar-section ul {
background: #fff; }
.top-bar .top-bar-section ul li a:not(.button), .top-bar .top-bar-section ul li.active a:not(.button) {
background: #fff;
line-height: 30px;
font-size: 16px;
padding: 0;
margin: 5px 0 0 0;
text-transform: uppercase; }
.top-bar .top-bar-section ul li a:not(.button):hover {
background: #fff;
border-bottom: 2px solid #c3c3c3;
color: #333; }
.top-bar .top-bar-section ul li.active a:not(.button) {
border-bottom: 2px solid #c3c3c3;
color: #333; }
.top-bar .top-bar-section ul li.active a:not(.button):hover {
background: #fff; }
.top-bar .top-bar-section ul li {
margin-left: 30px; }
.top-bar .top-bar-section ul li a {
color: #333; }
.top-bar .top-bar-section ul li:hover:not(.has-form) > a {
color: #333; }
.top-bar .top-bar-section li ul.dropdown {
background: #fff;
border: 1px solid #ddd;
color: #333; }
.top-bar .top-bar-section li ul.dropdown li {
border-bottom: 1px solid #ddd;
margin: 0;
padding: 5px 15px 5px 15px; }
.top-bar .top-bar-section li ul.dropdown li a:not(.button):hover, .top-bar .top-bar-section li ul.dropdown li a:not(.button) {
background: #fff;
color: #222;
border-bottom: none;
padding: 20px -4px 40px 45px; }
.top-bar .top-bar-section ul.dropdown li:hover:not(.has-form) > a:not(.button) {
background: #fff;
color: #222; }
.top-bar .has-dropdown > a:after {
border-color: rgba(0, 0, 0, 0.5) transparent transparent;
margin-top: -5px; }
/*# sourceMappingURL=scss.css.map */
#hidden{
display: inherit;
}
#hidden2{
display: none;
}
#media only screen and (max-width: 600px) {
#hidden{
display: none;
}
#hidden2{
display: inherit;
}
.top-bar {
margin-top: 0;
padding: 0;
float: none; }
.top-bar .toggle-topbar.menu-icon a {
color: #222; }
.top-bar .toggle-topbar.menu-icon a:after {
box-shadow: 0 10px 0 1px #222, 0 16px 0 1px #222, 0 22px 0 1px #222; }
.top-bar ul.title-area img {
margin: -2px 0 0;
width: 50px; }
.top-bar .top-bar-section ul {
background: #333; }
.top-bar .top-bar-section ul li {
margin-left: 0; }
.top-bar .top-bar-section ul li > a {
background: #fff;
border-radius: 0;
font-size: 0.9rem; }
.top-bar .top-bar-section ul li:not(.has-form) a:not(.button) {
background: none;
color: #222;
padding: 10px 15px;
margin-top: 0; }
.top-bar .top-bar-section ul li:not(.has-form) a:not(.button):hover {
background: #fff;
color: #222;
margin-top: 0; }
.top-bar .top-bar-section ul li.active:not(.has-form) a:not(.button) {
background: #fff;
color: #222;
padding: 10px 15px;
margin-top: 0; }
.top-bar .top-bar-section ul li.active:not(.has-form) a:not(.button):hover {
background: white;
margin-top: 0; }
.top-bar.padding-on-my-header ul.title-area img {
margin: 5px 13px 0;
width: 35px; }
.top-bar.expanded {
margin-top: 0;
padding: 0;
float: none; }
.top-bar.expanded .toggle-topbar.menu-icon a {
color: #222; }
.top-bar.expanded .toggle-topbar.menu-icon a:after {
box-shadow: 0 10px 0 1px #222, 0 16px 0 1px #222, 0 22px 0 1px #222; }
}
/* ////// END HEADER //////*/
You can do this with a little CSS. I use the Chrome inspector to find the right selectors to target.
example - http://codepen.io/rafibomb/pen/KpXEVe?editors=110
#media only screen and (max-width: 40.063em) {
.top-bar-section ul.social-icons li {
display: inline-block;
width: 25%;
float: left;
text-align: center;
}
}
I am having problems trying to center the navigation bar on my web page. I tried creating a wrapper div to center it, but it doesn't seem to work. The only thing that works in that div are changing the left margin. Here is the HTML:
body {
background: #bf5c71 url('body-bg.jpg');
}
.clearfix:after {
display: inline-block;
clear: both;
align-content: center;
}
/*----- Menu Outline -----*/
.menu-wrap {
box-shadow: inset 0px 0 0 rgba(255, 255, 255, 0.00);
-webkit-box-shadow: inset 0px 0 0 rgba(255, 255, 255, 0.00);
display: inline-block;
margin: 0px auto;
}
.menu {
display: inline-block;
margin: auto;
}
.menu li {
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
margin-bottom: 0px;
list-style: none;
font-family: 'Century Gothic';
}
.menu a {
transition: all linear 0.15s;
color: #FF283B;
}
.menu li:hover > a,
.menu .current-item > a {
color: #F5F5F5;
}
.menu .arrow {
font-size: 11px;
line-height: 0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float: left;
display: inline-block;
position: relative;
font-size: 18px;
}
.menu > ul > li > a {
padding-top: 2px;
padding-right: 2px;
padding-left: 2px;
padding-bottom: 2px;
display: inline-block;
text-shadow: 0px 0px 0px rgba(0, 0, 0, 0.00);
}
.menu > ul > li:hover > a,
.menu > ul > .current-item > a {
background: F5F5F5;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index: 1;
opacity: 1;
}
.sub-menu {
width: 100%;
padding: 3px 0px;
position: absolute;
top: 100%;
left: 0px;
z-index: -1;
opacity: 0;
transition: opacity linear 0.15s;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
background: 0;
}
.sub-menu li {
display: inline-block;
font-size: 16px;
}
.sub-menu li a {
padding-top: 10px;
padding-right: 20px;
padding-left: 20px;
padding-bottom: 5px;
display: inline-block;
}
.sub-menu li a:hover,
.sub-menu .current-item a {
background: #FF283B;
}
img {
border: thin solid #FF283B;
margin-left: 5%;
}
h3 {
margin-top: 3%;
font-size: 24px;
}
.wrapper {
display: inline-block;
margin: 0px auto;
}
<div class="wrapper">
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>
<div align="center">Home</a>
</div>
</li>
<li>
<div align="center">Projects <span class="arrow">▼</span>
<ul class="sub-menu">
<li>Image Adaptation
</li>
<li>Sonic Memory
</li>
<li>Documentary Video
</li>
</ul>
</div>
</li>
<li>
<div align="center">Resume
</div>
</li>
<li>
<div align="center">About
</div>
</li>
<li>
<div align="center">Contact
</div>
</li>
</ul>
</nav>
</div>
</div>
The only thing I can seem to do is just shift the bar left using margin-left.
Website: tylerbr.com
This is enough:
.content {
text-align: center;
}
You need to give your menu a width and change the display to "block"
Here is the style you need to change
.menu-wrap {
box-shadow: 0 0 0 rgba(255, 255, 255, 0) inset;
display: block;
margin: auto;
width: 880px;
}
Its a good idea to give a 100% width to the navbar. And the text-align center on the menu should do the trick.
.menu-wrap {
box-shadow: inset 0px 0 0 rgba(255,255,255,0.00);
-webkit-box-shadow: inset 0px 0 0 rgba(255,255,255,0.00);
display: inline-block;
margin: 0px auto;
width: 100%;
}
.menu {
width: 100%;
display: inline-block;
text-align: center;
}
What you are looking for is they style margin: 0 auto; take a look at this sample code and you will get it.
<style>
.wrapper{
width:100%;
height: 30px;
background: black;
}
.centered_div{
width: 200px;
background: red;
margin:0 auto;
}
</style>
<div class="wrapper">
<div class="centered_div">
test
</div>
</div>
I've made a css dropdown menu and I want each dropdown option to have a blue background when it is hovered on. However when I try this the background for the option will only be blue when the top half of it is hovered on. Here it is on jsfiddle. If you hover your mouse on the "products" option and then put the mouse under "plates" but above the gray horizontal line the background won't be blue. Can anybody help me? Thank you.
http://jsfiddle.net/hDWuJ/1/
HTML (Note this is a segment of my web page and so it does not have valid syntax)
<h1 id="title">Sample Text</h1>
<div id="HorzLineDiv"><hr></div>
<div id="MenuCenter">
<nav id="Menu" class="MenuBar">
<ul id="drop-nav">
<li>Home</li>
<li>Products <span id="arrowDown">▼</span>
<ul>
<li>Children's Stuff</li>
<li>Plates</li>
<li>Top Sellers</li>
</ul>
</li>
<li>Services <span id="arrowDown">▼</span>
<ul>
<li>Wash 'n' Fold</li>
<li>Blanket Making</li>
<li>Wedding Dress</li>
<li>Custom</li>
</ul>
</li>
</ul>
</nav>
</div>
CSS
body
{
background-color: #dfdfdf;
}
#title
{
text-align: center;
color: #07a8ca;
font-size:60pt;
margin: 0px;
padding: 0px;
text-shadow: 2px 2px 0px #888888;
}
h1
{
margin: 0px;
padding: 0px;
}
hr
{
height: 3px;
color: #07a8ca;
background: #07a8ca;
font-size: 0;
border: 0;
}
#HorzLineDiv
{
width: 95%;
margin: 2% 0% 3% 0%;
margin-left: auto ;
margin-right: auto ;
}
#Menu
{
width:100%;
}
#drop-nav
{
margin: 0 auto;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
}
ul
{
list-style: none;
padding: 0px;
margin: 0px;
}
ul li
{
display: block;
position: relative;
float: left;
display: inline;
padding: 12px 50px 8px 50px;
margin: 0px 5px 0px 5px;
border-left: 3px solid #07a8ca;
}
ul li:first-child
{
border-left: 0px;
}
li ul
{
display: none;
}
ul li a
{
display: block;
text-transform: uppercase;
text-decoration: none;
text-align:center;
color: #000;
font: 25px/1.1em "Kelly Slab","serif";
transition: color 0.4s ease 0s;
-moz-transition: color 0.4s ease 0s; /* Firefox 4 */
-webkit-transition: color 0.4s ease 0s; /* Safari and Chrome */
-o-transition: color 0.4s ease 0s; /* Opera */
}
ul li a:hover
{
color: #FF4D4D;
}
li:hover ul
{
display: block;
position: absolute;
}
li:hover li
{
float: none;
}
li:hover a
{
margin:0;
}
li:hover li a:hover
{
background: #21e8fa;
}
#drop-nav li ul li
{
border-top: 0px;
border-left: 0px;
}
#drop-nav ul li a
{
border-top: 3px solid #888;
padding: 13px 0px 13px 0px;
margin: -10px -8px;
text-align:center;
text-transform: none;
position:relative;
top: 13px;
color: #000;
}
#drop-nav ul
{
width:100%;
position:absolute;
right:-5px;
}
a
{
margin:0px;
padding:0px;
}
#arrowDown
{
font-size: 10pt;
vertical-align:text-bottom
}
The main issue is in your margins and padding, but this can be worked around by changing your ul li to display: block; instead of display: inline;.
Of course, this isn't a direct fix to the issue, and there still is an area at the bottom that doesn't work on hover, but it is much smaller than before. The proper way to go about fixing this is fixing your margins and padding.
Demo
UPDATE
Reading deeper into your code, I found the actual problem. It is not in margins or padding as I originally thought, but is a top property of 13px defined in #drop-nav ul li a. That top of 13px was creating a blank, inactive space in your list.
Get rid of that piece and it is working fine: DEMO
I am creating a little animation with glow in navigation.
Glow is behind the navigation menu as seen in picture.
I tried but not clear result, I need same result as shown in picture.
http://jsfiddle.net/naresh_kumar/GCpDW/5/
HTML
<div id="topnav" style="float:right;">
<ul class="nav clearfix">
<li id="menu-item-6">
Home
</li>
<li id="menu-item-8">
<a>Tutor Videos</a>
</li>
<li id="menu-item-7">
<a>Download Font</a>
</li>
<li id="menu-item-9">
<a>news</a>
</li>
</ul>
</div>
CSS
body{background:#000000;}
ul { margin-left: 20px; padding: 0; }
#topnav {
font-size: 8pt;
font-weight: bold;
margin-top: 2%;
float: left;
font-size: 8pt;
margin-bottom: 0;
margin-left: 63px;
margin-right: 0;
margin-top: 4% !important;
padding: 0;
width: 60%;
}
#topnav ul {
background: none repeat scroll 0 0 #E2E2DE;
border: 3px solid #FFFFFF;
line-height: 1;
list-style: none outside none;
margin: 0;
padding: 0;
}
#topnav ul li {
float: left;
width: auto;
}
#topnav ul li a {
border-bottom: 15px solid transparent;
border-top: 15px solid transparent;
display: block;
line-height: 30px;
margin: -17px 0;
}
#topnav ul a {
color: #000000 !important;
display: block;
line-height: 24px;
padding: 5px 10px;
position: relative;
text-decoration: none;
z-index: 90;
}
#topnav ul a:hover, #topnav ul ul a:hover {
border-color: white;
color: #0A0A0A;
box-shadow: 0 0 50px gold, 0 0 150px gold;
}
.clearfix:after, blockquote:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
.clearfix, blockquote {
display: block;
}
.clearfix, blockquote {
display: inline-block;
}
It's going to be difficult to get the glow 'behind' the menu just using CSS3 but with some minor tweaks (including more subtle use of colour for the glow) you can make the example you have already produced look quite reasonable with the glow on top of the menu
#topnav ul a:hover, #topnav ul ul a:hover {
border-color: white;
color: #0A0A0A;
box-shadow: 0 0 100px #ffffee, 0 0 100px #ffffee;
}
i found this menu that's exactly what i want. It works in all modern browsers and IE 7/8. I need to find a fix for it to work in IE6. Any help would be greatly appreciated.
http://lab.returnwt.net/htmlcss/tabmenu/
The problem with this menu in IE6 is that it's using selectors like this:
header ul#menu li:hover ul
IE6 only supports :hover on a elements.
Fortunately, there's a really easy fix to make this menu work in IE6.
It's called Whatever:hover
Download the (minified) csshover3.htc file.
Add this CSS:
body {
behavior: url("csshover3.htc");
}
Here's a self-contained file that I tested to work with IE6, provided that the csshover3.htc file is in the same folder:
<!DOCTYPE html>
<html>
<head>
<title>Simple Tabbed Navigation - CSS3</title>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<meta charset="utf-8" />
<style>
body {
behavior: url("csshover3.htc");
}
body
{
background: #efefef url(images/bg_main.png);
font: 13px Helvetica, Arial;
margin: 0;
}
header
{
background: url(images/bg_head.png);
display: block; /* Compatibility fix */
}
header:after
{
background: rgba(0, 0, 0, 0.1);
content: ' ';
height: 1px;
position: absolute;
width: 100%;
z-index: 10;
}
header ul#menu
{
border-bottom: 5px solid #fff;
margin: 0;
overflow: hidden;
padding: 0 10px;
padding-top: 100px;
list-style: none
}
header ul#menu li
{
float: left;
}
header ul#menu li a
{
background: #b1d0dd;
border-top: 1px solid #d0e2ea;
color: #fff;
font-weight: bold;
display: block;
line-height: 34px;
margin-right: 2px;
padding: 0 20px;
text-decoration: none;
text-shadow: 0 -1px rgba(0, 0, 0, 0.25);
border-radius: 3px 3px 0 0; /* Currently working on Firefox 4.0b (Nightly), Chrome 8.0.xxxx and Opera 10.63+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#B1D0DD), to(#89b8cc));
background-image: -moz-linear-gradient(top, #B1D0DD, #89B8CC);
}
header ul#menu li > ul
{
display: none;
}
header ul#menu li a:hover
{
background: #fff;
border-top-color: #fff;
color: #666;
text-shadow: none;
}
header ul#menu ul {
background: #fff;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
display: none;
margin-left: 0;
margin: 0;
padding: 5px 0 0 0;
position: absolute;
z-index: 999;
}
header ul#menu ul li
{
border: 1px solid rgba(0, 0, 0, 0.1);
border-width: 0 1px;
float: none;
list-style: none;
margin: 0;
padding: 0;
}
header ul#menu ul li a
{
background: none;
border-bottom: 1px solid #ededed;
border-top: none;
color: #666;
font-weight: normal;
font-size: 12px;
margin: 0 20px;
padding: 0;
text-shadow: none;
width: 118px;
}
header ul#menu li a.home-icon span
{
background: url(images/home-icon.png) no-repeat center center;
display: block;
text-indent: -999em;
overflow: hidden;
text-align: left;
direction: ltr;
width: 16px;
}
header ul#menu li a.home-icon:hover span
{
background-image: url(images/home-icon-hover.png);
}
header ul#menu ul li:last-child a
{
border-bottom: none;
}
header ul#menu li:hover ul
{
display: block;
}
header ul#menu ul li a:hover
{
color: #000;
}
header ul#menu ul li:last-child
{
border-bottom: none
}
</style>
</head>
<body>
<header>
<ul id="menu">
<li><span>Home</span></li>
<li>
Community
<ul>
<li>Recent Activity</li>
<li>Member Forum</li>
<li>Member List</li>
<li>Member Groups</li>
</ul>
</li>
<li>Pet Help</li>
<li>Pets for Sale</li>
<li>Pet Services</li>
</ul>
</header>
</body>
</html>