I have an unordered list navigation menu in which I'm using css3 to fade in the background image on hover. The swapping of the images is working, but there is no transition or fade. Instead its just immediate. You can see here http://bokushucom.ipage.com/Miltonkarate/karate_test/
this is the mark up I'm using
<div id="header">
<div id="navMenu">
<div class="table">
<li>Home</li>
<li>Lil' Dragons</li>
<li>Junior Program</li>
<li>Adult Program</li>
<li>Kendo</li>
<li>Tai Chi</li>
<li>Contact</li>
</div>
</div><!--end of navMenu-->
</div><!--end of header-->
and the CSS
#navMenu {
position:absolute;
height:34px;
width:940px;
bottom:18px;
text-align:center;
font-family:Arial, Helvetica, sans-serif;
left:0;
font-size: 12px;
list-style:none;
}
.table {
display: table; /* Allow the centering to work */
margin: 0 auto;
}
#navMenu li {
display: block;
float:left;
height:34px;
border-left:1px solid #5A5A5A;
border-right:1px solid #333;
position:relative;
line-height: 34px;
}
#navMenu li a {
display:block;
height:34px;
position:relative;
color:#FFF;
padding-left:15px;
padding-right:15px;
background:url(../images/navMenuBG.jpg) repeat-x;
-webkit-transition: background 2s 3s ease-in;
-moz-transition: background 2s 3s ease-in;
-o-transition: background 2s 3s ease-in;
transition: background 2s 3s ease-in;
}
#navMenu a:hover {
background:url(../images/navMenu_shadow.png);
height:35px;
color: #666;
}
I'm pretty new to CSS3. Perhaps I'm missing something?
There are a few things you need to correct on your code,
Change #navMenu a:hover to #navMenu li a:hover. This is just to make it more specific.
You are specifying duration two times on your transition line. Change transition: background 2s 3s ease-in; to transition: background 2s ease-in;. And consequently change all the transition lines.
Here's a Live Demo.
I hope this resolved your issue.
Just to note: 2s or 3s in the transition makes the effect look very slow. Make it less and it'll definitely look better.
Related
Is it possible to achieve a two-color border like the one in the following picture (black/gray) using Qt styles?
I've already tried to set the border style to groove (see my example below) but in this case the "2nd" color seems to be automatically generated based upon the first color setting. When I set the border color to black, the resulting "2nd" color becomes black, too.
QFrame#MainWorkspace{
background-color: #3a3a3a;
border: 2px groove #000000;
border-radius: 4px;
}
So, how can I achieve a two-colored border where each color is settable individually?
body{background-color: #3a3a3a;}
.MainWorkspace{
width:30px;
height:24px;
background-color: #3a3a3a;
border: 2px groove #000000;
border-radius: 4px;
color:#FF0000;
text-align:center;
padding-top:6px;
box-shadow: inset 0px 0px 3px rgba(234,234,234,0.9);
margin:5px 1px;
float:left;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div id="MainWorkspace" class="MainWorkspace">
<i class="fa fa-bars"></i>
</div>
<div class="MainWorkspace">
<i class="fa fa-th"></i>
</div
I'm learning Zurb Foundation 4 from Lynda.com videos and documentations on Foundation's website.
I have come to this problem when I create my top nav bar. It appears on Foundation's main website, and the training videos from Lynda that the top navigation bar's menu "names" will change colors when the mouse is over (Zurb Foundation 4 official site), as well as the button gradually changing color, which is beautiful!
I build my navigation bar, and my menu names are not changing colors, my button on the navigation bar is not changing colors either (but these buttons do change color while being displayed on some other part of the page).
This is my code for the navigation bar:
<nav class="top-bar hide-for-small">
<ul class="title-area">
<!-- Title Area -->
<li class="name">
<h1>Windweller's Blog</h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<!-- Right Nav Section -->
<section class="top-bar-section">
<ul class="right">
<li class="divider"></li>
<li class="active">Home</li>
<li class="divider"></li>
<li>Project</li>
<li class="divider hide-for-small"></li>
<li class="has-form"><a class="button active" href="#">About Me</a></li>
</ul>
</section>
</nav>
I'm not sure this is resulted from my markup error or this is the default setting of Foundation 4. If this is the default setting (no color change in top nav bar), how should I properly add those effects by myself? (Overriding the CSS or using jQuery to apply classes?)
Update:
I wrote this in my custom.css file and I made the top bar color change happen
.top-bar-section li a:hover:not(.button) {
background: #222222;
}
I found this line of code in the original Foundation.css file, but there is no ":hover" on it...yet still, my button is not changing color.
I tried to add this as I found it again in original Foundation.css file, but I just couldn't get it to work.
.top-bar-section .button :hover {
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
Might not be the best solution, but try
.top-bar-section ul li a:hover {
background-color: #222222 !important;
}
user2677732's code seems to do the trick. Extending it to style dropdown items separately would look something like:
/* Main Item selector */
.top-bar-section li a:hover {
color: #fff;
background-color: #2ba6cb;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out; }
/* Dropdown Item selector */
.top-bar-section li li a:hover {
color: #2ba6cb;
background-color: #fff;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out; }
#media only screen and (min-width: 58.75em) {
.top-bar {
background: #ffffff;
change [background #ffffff;] to any color you want
Ok, I'm trying to tinker with my navigation menu. I want something like this website:
http://aleksfaure.com/
He has a single image (logo) centered with 2 menu links on either side. I've tried a couple of different things, including just using my logo as an image centered at the top, in between the menu. No dice.
Here's the relevant HTML and CSS I have with my current nav menu. I'm still kind of a intermediate beginner at this.
HTML
<nav role="navigation">
<ul id="nav">
<li>Home</li>
<li>About Me</li>
<ul id="nav-right" style="float:right;">
<li>Portfolio</li>
<li>Contact</li> </ul>
</ul></nav>
CSS
#header nav {
position: relative;
width: 700px;
height: 163px;
display: block;
margin: 0 auto;
text-align: center;
}
#header nav ul li {
float: left; list-style: none;
}
ul#nav li a {
display: block;
width: 100px;
height: 100px;
padding: 50px 0 0 0;
margin: 0 10px 0 10px;
font-family: 'MuseoSlab-500', Helvetica, sans-serif;
font-size: 16px;
text-transform: uppercase;
color: #000;
text-shadow: 0 2px 1px #bbbaba;
text-decoration: none;
}
ul#nav li a.mainnav:hover {
color: #13cad1;
text-shadow: 0 2px 1px #fff;
}
You don't need to use two separate lists. Treat the entire menu, including your image, as one list. Consider something like this for your HTML:
<div>
<ul id="nav">
<li>Home</li>
<li>About Me</li>
<li><img src="images/yourLogo.png"></li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div>
And make sure you have your style set to float: left;
#nav li { float: left; list-style: none;}
Then, just center the entire div on the page, and style your links as you want.
SEPARATE NOTES:
In your code, you are missing the closing tag for your first unordered list.
The navigation element is not very widely supported, so depending on your audience you may want to use a div.
So in my code I have a sticky footer. And the sticky footer has the #wrap container with a min-height of 100%. But with min-height you can't use height:100% on objects inside the wrap div.
So I add height:100% but it messes with the layout by making the footer roll over the content in the wrap div when window height is too small.
Anyone have fixes for this?
<div id="wrap">
<div id="main">
<div id="content">
</div>
</div>
<div class="clearfooter"></div>
</div>
<div id="footer">
</div>
CSS:
*{
padding: 0px;
margin: 0px;
}
html, body {
height: 100%;
}
body{
color: #FFF;
background-image:url('../images/black_denim.png');
}
#wrap {
min-height: 100%;
margin-bottom: -200px;
position: relative;
}
#topBanner{
width: 200px;
margin: 0px auto;
}
.clearfooter {
height: 200px;
clear: both;
}
/* footer */
#footer {
position: relative;
height: 200px;
width: 100%;
min-width: 960px;
}
If all you need is a sticky footer that doesn't cover up any of the body's content then just give the footer a fixed position and give the bottom of the body padding equal to the footers height.
body{
padding-bottom:200px;
}
#footer {
position: fixed;
bottom:0;
height: 200px;
width: 100%;
}
EDIT:
if your concern is that on very small screens the fixed footer covers up most of the screen then there is no workaround for this except for maybe hiding the footer dynamically using css media queries or javascript.
many mobile browsers do not support fixed positions precisely because of the issue of them covering large portions of the screen.
I am going through some minor issues here. I am using a standard container height and css code for all pages. For most pages there is enough content to fill it and for some the content may only take 10-20% of the page. So is it a good idea for those pages to use a different min-height? Below is the code:
#wrapper {
background-color: #999999;
margin:0 auto;
min-height: 600px;
width:770px;
font-family: "Lucida Grande", Verdana, "Lucida Sans Unicode", Arial, Helvetica,
sans-serif;
font-size:15px;
color: #222222;
margin-left:60px;
margin-bottom:60px;
}
It might be better to declare the lesser min-height in a separate class.
Then, you could do <div id="wrapper" class="smallerContent">.
#wrapper.smallerContent {
min-height: 300px
}