Mouse move hover to (Main - 1) cause move slowly down (drop down menu) on (Level 1 - 1) to (Level 1 - 4).
Mouse move rollover to (Main - 2) make drop down menu slowly move down.
UL then LI (Main - 1) on hover then UL then appear LI (Level 1 - 1) to (Level 1 - 4) slowly drop down menu.
Not worry about (Main - 4) ignore it.
I don't know where put "-webkit-transition: height 2.75s ease .5s;" into ul and li?
/*
Where can I put drop down menu slwoly?
-webkit-transition: height 2.75s ease .5s;
-moz-transition: height 2.75s ease .5s;
-ms-transition: height 2.75s ease .5s;
-o-transition: height 2.75s ease .5s;
transition: height 2.75s ease .5s;
and
-webkit-transition: opacity 2.75s ease .5s;
-moz-transition: opacity 2.75s ease .5s;
-ms-transition: opacity 2.75s ease .5s;
-o-transition: opacity 2.75s ease .5s;
transition: opacity 2.75s ease .5s;
*/
/*Begin Horizontal Tag.*/
/*Set the parent <li>'s CSS position property to 'relative'.*/
ul {
z-index: 999;
list-style:none;
line-height: 150%;
padding:0px;
margin:0px auto 0 auto;
width: -webkit-fit-content;
width: -moz-fit-content;
width: -ms-fit-content;
width: -o-fit-content;
width: fit-content;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
border-radius: 15px;
}
ul li {
display: block;
padding: 0px 10px 0px 10px;
position: relative;
float: left;
border-left: 3px solid lightgray;
border-right: 3px solid lightgray;
background: -webkit-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: -moz-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: -ms-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: -o-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: linear-gradient(top, #534b4f 0%,#cc5500 100%);
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
}
/*The CSS to hide the sub menus.*/
li ul {
display:none;
}
ul li a {
display: block;
padding: 0px;
text-decoration: none;
white-space: nowrap;
color: #ffffff;
}
ul li a:hover {
}
/*Displays the dropdown menu on hover.*/
li:hover > ul {
display: block;
position: absolute;
}
/*try*/
li li {
}
/*Try*/
li:hover li {
float: none;
}
li:hover {
background: #000000;
}
li:hover li a:hover {
}
.main-navigation li ul li {
border-top: 0px;
}
/*Display second level dropdown menus to the right of the first level dropdown menu.*/
ul ul ul {
left: 100%;
top: 0px;
}
/*Simple clearfix.*/
ul:before, ul:after {
content: " "; /* 1 */
display: table; /* 2 */
}
ul:after {
clear: both;
}
<ul>
<li>Main - 1
<ul>
<li>Level 1 - 1</li>
<li>Level 1 - 2</li>
<li>Level 1 - 3</li>
<li>Level 1 - 4</li>
</ul>
</li>
<li>Main - 2
<ul>
<li>Level 2 - 1
<ul>
<li>Level next 2 - 1</li>
<li>Level next 2 - 2</li>
<li>Level next 2 - 3</li>
<li>Level next 2 - 4</li>
</ul>
</li>
<li>Level 2 - 2</li>
<li>Level 2 - 3</li>
<li>Level 2 - 4</li>
</ul>
</li>
<li>Main - 3
<ul>
<li>Level 3 - 1</li>
<li>Level 3 - 2</li>
<li>Level 3 - 3</li>
<li>Level 3 - 4</li>
</ul>
</li>
<li>Main - 4</li>
</ul>
If you want to have opacity transitions, then you cannot use the display none/block in your styles. You should use then opacity values for hiding & displaying content. And this should be placed in the ul > li > ul.
With heights, same issue. You need to play with the heights in order to use the height transition (not with display). For heights case the logical place would be to place it in the same ul > li > ul but this is not possible with the current styling as that ul contents are floating (and thus that ul height definition doesn't have any effect). Additionally height transition doesn't work from 0px => auto/100% so the solution is to use max-height values & transition instead.
Please feel free to correct my statements / assumptions above if someone finds them strange/incorrect.
So this styling would result in what you're after (assuming that I understood the desired result correctly). Result visible in this fiddle.
/*Begin Horizontal Tag.*/
/*Set the parent <li>'s CSS position property to 'relative'.*/
ul {
z-index: 999;
list-style:none;
line-height: 150%;
padding:0px;
margin:0px auto 0 auto;
width: -webkit-fit-content;
width: -moz-fit-content;
width: -ms-fit-content;
width: -o-fit-content;
width: fit-content;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
border-radius: 15px;
}
ul li {
display: block;
padding: 0px 10px 0px 10px;
position: relative;
float: left;
border-left: 3px solid lightgray;
border-right: 3px solid lightgray;
background: -webkit-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: -moz-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: -ms-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: -o-linear-gradient(top, #534b4f 0%,#cc5500 100%);
background: linear-gradient(top, #534b4f 0%,#cc5500 100%);
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
}
ul > li > ul > li {
max-height: 0px;
}
/*The CSS to hide the sub menus.*/
li ul {
position: absolute;
opacity: 0;
filter: alpha(opacity=0);
}
ul li a {
//display: block;
padding: 0px;
text-decoration: none;
white-space: nowrap;
color: #ffffff;
}
/*Displays the dropdown menu on hover.*/
li:hover > ul {
opacity: 1;
filter: alpha(opacity=100);
-webkit-transition: opacity 1.75s ease 4s;
-moz-transition: opacity 1.75s ease .4s;
-ms-transition: opacity 1.75s ease .4s;
-o-transition: opacity 1.75s ease .4s;
transition: opacity 1.75s ease .4s;
}
li:hover > ul > li {
max-height: 1000px;
-webkit-transition: max-height 2.75s ease .5s;
-moz-transition: max-height 2.75s ease .5s;
-ms-transition: max-height 2.75s ease .5s;
-o-transition: max-height 2.75s ease .5s;
transition: max-height 2.75s ease .5s;
}
/*try*/
li li {
}
/*Try*/
li:hover li {
float: none;
}
li:hover {
background: #000000;
}
li:hover li a:hover {
}
.main-navigation li ul li {
border-top: 0px;
}
/*Display second level dropdown menus to the right of the first level dropdown menu.*/
ul ul ul {
left: 100%;
top: 0px;
}
/*Simple clearfix.*/
ul:before, ul:after {
content: " "; /* 1 */
display: table; /* 2 */
}
ul:after {
clear: both;
}
Related
I have a simple question. I am trying to add a fade-in effect to the submenus like in this page but I don't really understand the ul li ul selectors concept well and so it is not coming out correct.,
It doesn't seem really difficult but I am doing something wrong which I can't figure out!!
How can I add this CSS transition effect? I have tried using the animate.css library but usage of the library is not mandatory and I am OK with a solution which doesn't use it also.
.classname li:hover > ul{
display:block;
-moz-animation: fadeInUp .3s ease-in ;
-webkit-animation: fadeInUp .3s ease-in ;
animation:fadeInUp .3s ease-in ;
}
.classname ul li:hover > ul{
display:block;
-moz-animation: fadeInRight .3s ease-in ;
-webkit-animation: fadeInRight .3s ease-in ;
animation:fadeInRight .3s ease-in ;
}
Demo: Below is a snippet which has my current coding attempt.
/* MENU NAVIGATION */
#nav span {
display: none;
}
#nav,
#nav ul {
list-style: none outside none;
margin: 0;
padding: 0;
}
#nav {
font-family: 'Josefin Sans', sans-serif;
float: left;
margin-left: 1%;
margin-right: 1%;
position: relative;
width: 98%;
}
#nav ul.subs {
background-color: #FFFFFF;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
color: #333333;
display: none;
left: 0;
padding: 2%;
position: absolute;
top: 54px;
width: 96%;
}
#nav > li {
border-bottom: 5px solid transparent;
float: left;
margin-bottom: -5px;
text-align: left;
-moz-transition: all 300ms ease-in-out 0s;
-ms-transition: all 300ms ease-in-out 0s;
-o-transition: all 300ms ease-in-out 0s;
-webkit-transition: all 300ms ease-in-out 0s;
transition: all 300ms ease-in-out 0s;
}
#nav li a {
display: block;
text-decoration: none;
-moz-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
-ms-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
-o-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
-webkit-transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
white-space: normal;
}
#nav > li > a {
color: #333333;
display: block;
line-height: 49px;
padding: 0 15px;
text-transform: uppercase;
}
#nav > li:hover > a,
#nav > a:hover {
background-color: #F55856;
color: #FFFFFF;
}
#nav li.active > a {
background-color: #333333;
color: #FFFFFF;
}
/* submenu */
#nav li:hover ul.subs {
display: block;
}
#nav ul.subs > li {
display: inline-block;
float: none;
padding: 10px 1%;
vertical-align: top;
width: 33%;
}
#nav ul.subs > li a {
color: #777777;
line-height: 20px;
}
#nav ul li a:hover {
color: #F55856;
}
#nav ul.subs > li > a {
font-size: 1.3em;
margin-bottom: 10px;
text-transform: uppercase;
}
#nav ul.subs > li li {
float: none;
padding-left: 8px;
-moz-transition: padding 150ms ease-out 0s;
-ms-transition: padding 150ms ease-out 0s;
-o-transition: padding 150ms ease-out 0s;
-webkit-transition: padding 150ms ease-out 0s;
transition: padding 150ms ease-out 0s;
}
#nav ul.subs > li li:hover {
padding-left: 15px;
}
<div class="container">
<ul id="nav">
<li>Home
</li>
<li>Prodotti
<span id="s1"></span>
<ul class="subs">
<li>Header a
<ul>
<li>Submenu x
</li>
<li>Submenu y
</li>
<li>Submenu z
</li>
</ul>
</li>
<li>Header b
<ul>
<li>Submenu x
</li>
<li>Submenu y
</li>
<li>Submenu z
</li>
</ul>
</li>
</ul>
</li>
<li>Shop
</li>
<li>Area Privata
</li>
<li>Contatti
</li>
</ul>
</div>
There is no need for an animation or a separate library to achieve the effect that you need. These can be achieved by just using transitions and some CSS transforms.
Demo: (explanation is provided below).
/* MENU NAVIGATION */
#nav span {
display: none;
}
#nav,
#nav ul {
list-style: none outside none;
margin: 0;
padding: 0;
}
#nav {
font-family: 'Josefin Sans', sans-serif;
float: left;
margin-left: 1%;
margin-right: 1%;
position: relative;
width: 98%;
}
#nav ul.subs {
background-color: #FFFFFF;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
color: #333333;
left: 0;
padding: 2%;
position: absolute;
top: 54px;
width: 96%;
}
#nav > li {
border-bottom: 5px solid transparent;
float: left;
margin-bottom: -5px;
text-align: left;
transition: all 300ms ease-in-out 0s;
}
#nav li a {
display: block;
text-decoration: none;
transition: color 450ms ease-in-out 0s, background-color 450ms ease-in-out 0s;
white-space: normal;
}
#nav > li > a {
color: #333333;
display: block;
line-height: 49px;
padding: 0 15px;
text-transform: uppercase;
}
#nav > li:hover > a,
#nav > a:hover {
background-color: #F55856;
color: #FFFFFF;
}
#nav li.active > a {
background-color: #333333;
color: #FFFFFF;
}
/* submenu */
#nav ul.subs > li {
display: inline-block;
float: none;
padding: 10px 1%;
vertical-align: top;
width: 33%;
}
#nav ul.subs > li a {
color: #777777;
line-height: 20px;
}
#nav ul li a:hover {
color: #F55856;
}
#nav ul.subs > li > a {
font-size: 1.3em;
margin-bottom: 10px;
text-transform: uppercase;
}
#nav ul.subs > li li {
float: none;
padding-left: 8px;
transition: padding 150ms ease-out 0s;
}
#nav ul.subs > li li:hover {
padding-left: 15px;
}
#nav > li > ul {
opacity: 0;
transform: translateY(25%);
transition: all 150ms ease;
pointer-events: none;
}
#nav > li:hover > ul {
opacity: 1;
transform: translateY(0%);
pointer-events: auto;
}
#nav > li > ul > li > ul {
opacity: 0;
transform: translateX(50%);
transition: all 150ms ease;
}
#nav > li > ul > li:hover > ul {
opacity: 1;
transform: translateX(0%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class="container">
<ul id="nav">
<li>Home
</li>
<li>Prodotti
<span id="s1"></span>
<ul class="subs">
<li>Header a
<ul>
<li>Submenu x
</li>
<li>Submenu y
</li>
<li>Submenu z
</li>
</ul>
</li>
<li>Header b
<ul>
<li>Submenu x
</li>
<li>Submenu y
</li>
<li>Submenu z
</li>
</ul>
</li>
</ul>
</li>
<li>Shop
</li>
<li>Area Privata
</li>
<li>Contatti
</li>
</ul>
</div>
Code Explained:
In order to produce an effect similar to that in the page which you linked (that is, the 1st level submenu does a fade-in + move up on hover and the 2nd level sub-menu does a fade-in + move left on hover), the following things need to be done:
Currently you are toggling the display property of the ul that contains the first level submenu when hovering on PRODOTTI. But change of value to the display property is not transitionable and because of this the submenu will appear in an instant. Just remove the lines that cause this.
#nav ul.subs {
background-color: #FFFFFF;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
color: #333333;
/*display: none; comment out or remove this line */
left: 0;
padding: 2%;
position: absolute;
top: 54px;
width: 96%;
}
/* remove these */
#nav li:hover ul.subs {
display: block;
}
After that set the initial state of the ul that contains the submenu to have opacity: 1 and also add transform: translateY(25%) to it. This will push the submenu's container down by 25% of its height.
#nav > li > ul{
opacity: 0;
transform: translateY(25%);
transition: all 150ms ease;
pointer-events: none;
}
When the PRODOTTI link is hovered, change the submenu's opacity to 1 and translate it back to its original position by setting `transform: translateY(0%). This makes it look as though the submenu is fading-in and is moving up at the same time.
#nav > li:hover > ul{
opacity: 1;
transform: translateY(0%);
pointer-events: auto;
}
For the second level submenu, the same steps are followed except that instead of using translateY, we are using translateX because it has to be moved to the right and not down.
#nav > li > ul > li > ul{
opacity: 0;
transform: translateX(50%);
transition: all 150ms ease;
}
#nav > li > ul > li:hover > ul{
opacity: 1;
transform: translateX(0%);
}
I want to reduce the size of the drop down menus to the same as the buttons. Adjusting either the padding or margin would move the items out of place and close themselves when I try to hover over it. I'd like to know what is causing this. Here's the Fiddle
Any help would be great.
CSS:
.sort ul {
text-align: left;
display: inline;
margin: 0;
list-style: none;
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
float:right;
}
.sort ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #FF5C00 url(http://i1350.photobucket.com/albums/p769/Stonecold_Stone/Games/SoManySales/Joint%20Supplement/alert-overlay_zpsf561d19b.png) repeat-x;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
color:#fff;
}
.sort ul li:hover {
background: #555;
color: #fff;
}
.sort ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.sort ul li ul li {
background: #FFDFDF;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
z-index:9999;
}
.sort ul li ul li:hover { background: #666; }
.sort ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
.button, ul{ padding-left: 15px;}
.button {
list-style: none; cursor: pointer;
float: left; margin: 10px 10px;
background-color: #039fd3; color: #fff;
padding: 5px 10px;
font-size: 13px;
border-radius: 3px;
-webkit-transition:background-color 0.3s ease-in;
-moz-transition:background-color 0.3s ease-in;
-o-transition:background-color 0.3s ease-in;
transition:background-color 0.3s ease-in;
}
HTML:
<div class="sort"><ul>
<li>
Sort AXXX
<ul>
<li><a href='#'>SXXXX</a></li>
<li><a href='%#%'>AXXXx</a></li>
</ul>
</li>
<li>Sort BXXX
<ul>
<li><a href='%#%'>CXXXX</a></li>
</ul>
</li>
<li>Sort C
<ul>
<li><a href='%#%'>WSXXXX</a></li>
<li><a href='%#%'>SXXXX</a></li>
</ul>
</li>
</ul></div>
Following the op coding style, in order to adjust the width of the dropdown it is required to set a width value for the list items under .sort div. Also added paddings similar to the ones set to the blue buttons on the left.
.sort ul li{
width:70px;
padding-top:5px;
padding-bottom:5px;
padding-left:5px;
padding-right:5px;
}
Also it is necesary to adjust the top relative position of the sub menu to always be below the the main menu,
.sort ul li ul{
top:100%;
}
To adjust the distance from the top of the menu to be the same as with the buttons, it is possible to tweak the top relative distance of the menu to achieve it.
The ul element containing the buttons is a block element and the list items within it are floated with a margin-top of 10px and padding-top of 5px so a total of 15px from the top. The ul element within div.sort is floated to the right and has a padding-top of 5px so with margin-top 10px (i.e. 15-5) should be aligned with the buttons.
.sort > ul{
margin-top:10px;
}
http://jsfiddle.net/fLSyE/
First is, if you want your buttons and drop down menu to have the same size, just set the width to be the same. Here is an example(from your code):
.sort ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 100px; /* set width of drop down menu to 100px */
-webkit-box-shadow: none;
/* SOME OTHER CODES FOLLOW */
}
.sort ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
width: 100px; /* also set the width of the menus to 100px */
position: relative;
padding: 15px 20px;
}
Hope it helps!
I'm working on getting my site up and running, and I've run into a problem with my drop-down navigation menu in Firefox.
I have been using the site in Chrome and it works fine, it is a simple setup of nested lists for the selections. The options appear, but they are floating to the left instead of directly below their appropriate section.
CSS:
/*sub-menu navigation*/
nav.primary ul ul
{
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
z-index: 999;
background: #111111;
height: 0px;
overflow: hidden;
min-width: 100%;
-webkit-transition: opacity 0.4s ease-out;
-moz-transition: opacity 0.4s ease-out;
-o-transition: opacity 0.4s ease-out;
-ms-transition: opacity 0.4s ease-out;
transition: opacity 0.4s ease-out;
-webkit-box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
}
nav.primary ul li:hover ul
{
opacity: 10;
filter: alpha(opacity=100);
height: auto;
overflow: auto;
}
nav.primary ul ul li
{
float: none;
display: list-item;
border-bottom: 1px solid #747474;
}
nav.primary ul ul li a
{
display: block;
margin-left: 10px;
line-height: 40px;
font-size: 0.8em;
/*text-transform: none;*/
font-family: 'LibbyRegular', Helvetica, Arial, sans-serif;
}
Menu HTML
<ul>
<li>independent work
<ul>
<li>>> big and ugly</li>
<li>>> iceworld</li>
<li>>> gordon's got game</li>
</ul>
</li>
<li>team projects
<ul>
<li>>> blastrobots</li>
<li>>> ruined</li>
</ul>
</li>
<li>scripting
<ul>
<li>>> hero man (C#)</li>
<li>>> CloneOut (lua)</li>
<li>>> shotgun (unrealscript)</li>
</ul>
</li>
<li>resume</li>
</ul>
The site is http://lvsherman.com if you would like to test it.
Try adding to your inner UL elements.
left: 0;
top: WHATEVER;
I have a drop menu using CSS and now I am told they would like the drop menu to display a bit slower. Everything works great, but I am so far unable to slow down the transition when a user hovers over the navigation. What is the best way of doing this with a CSS only solution?
Demo on JSFiddle
HTML
<nav>
<ul>
<li>Line 1</li>
<li>Line 2
<ul>
<li>SubCat 1</li>
<li>SubCat 2</li>
<li>SubCat 3</li>
</ul>
</li>
<li>Line 3
<ul>
<li>SubCat 4</li>
<li>SubCat 5</li>
<li>SubCat 6</li>
</ul>
</li>
<li>Line 4
<ul>
<li>SubCat 7</li>
<li>SubCat 8</li>
<li>SubCat 9</li>
</ul>
</li>
</ul>
</nav>
CSS
nav {
background: url(../images/global/Navigation_Full.png) no-repeat;
width: 540px;
height: 54px;
margin: 0 auto;
color: #000;
}
nav ul{
display: inline-table;
list-style: none;
width: 100%;
position: relative;
border-top: 1px solid #FF9F69;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav ul ul {
display: none;
position: absolute;
width: auto;
top: 100%;
}
nav ul li:hover > ul {
display: block;
}
nav li:first-child {
border-left: none;
}
nav li {
text-align: center;
margin-left: 1px;
float: left;
height: 38px;
line-height: 40px;
padding: 0 10px;
}
nav li a {
padding: 10px 17px;
font-size: 0.813em;
text-decoration: none;
text-shadow: inherit;
color: #000;
}
nav li:hover {
box-shadow: 1px 1px 20px 1px rgba(64, 23, 0, 0.4) inset;
-webkit-transition-property:color, background;
-moz-transition-property:color, background;
-webkit-transition-duration: 0.2s;
-moz-transition-duration: 0.2s;
-webkit-transition-timing-function: linear, ease-in;
-moz-transition-timing-function: linear, ease-in;
}
nav ul ul {
background: rgb(125,56,16); /* Old browsers */
background: -moz-linear-gradient(top, rgba(125,56,16,1) 0%, rgba(233,103,31,1) 30px, rgba(233,103,31,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(125,56,16,1)), color-stop(30px,rgba(233,103,31,1)), color-stop(100%,rgba(233,103,31,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(125,56,16,1) 0%,rgba(233,103,31,1) 30px,rgba(233,103,31,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(125,56,16,1) 0%,rgba(233,103,31,1) 30px,rgba(233,103,31,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(125,56,16,1) 0%,rgba(233,103,31,1) 30px,rgba(233,103,31,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(125,56,16,1) 0%,rgba(233,103,31,1) 30px,rgba(233,103,31,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7d3810', endColorstr='#e9671f',GradientType=0 ); /* IE6-9 */
border-radius: 0px; padding: 0;
border-top: none;
z-index: 1;
}
nav ul ul li {
float: inherit;
position: relative;
border-left: none;
border-right: none;
text-align: left;
font-size: 1em;
font-weight: lighter;
}
nav ul ul li a {
color: #fff;
}
nav ul ul li a:hover {
color: #000;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
You have animated the main menu but not the dropdown.
I have changed the transition in the dropdown from setting display:block to setting opacity to 1,
nav ul li:hover > ul {
display: block;
opacity: 1;
}
and to the base element, added display block, set opacity to 0, and animated that.
nav ul ul {
background: rgb(125,56,16); /* Old browsers */
display: block;
opacity: 0;
-webkit-transition: opacity 3s;
}
The result is:
http://jsfiddle.net/vals/SmNq3/1/
CSS3 Transitions have a duration property that you can set.
#example
{
transition-property: top;
transition-duration: 2s;
}
Note: Support may require the use of vendor prefixes (-webkit, -o, -ms, -moz).
Try this code in your css
div {
overflow:hidden;
background:#000;
color:#fff;
height:0;
padding: 0 18px;
width:100px;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
transition: all .5s ease;
}
.animated {
height:auto;
padding: 24px 18px;
}
Check this http://jsfiddle.net/catharsis/n5XfG/17/
I am trying to extend my header to cover the full page. http://dev.webgrowth.biz/ and I want it look like this one http://www.webgrowth.biz/ I have been trying everything for hours now. any help would be highly appreciated.
Live Demo
You can achieve the effect using a container element, then just set the containing elements margin to 0 auto and it will be centered.
Markup
<div id="header">
<div id="headerContent">
Header text
</div>
</div>
CSS
#header{
width:100%;
background: url(yourimage);
}
#headerContent{
margin: 0 auto; width: 960px;
}
Just set the header width to be 100vw to make it full screen width
and set the header height to be 100vh to make it full screen height
#header {
margin: 0;
padding: 0;
width: 100%;
background: xxxx;
}
#header #content {
margin: 0px auto;
width: 800px; /* or whatever */
}
<div id="header">
<div id="content">
stuff here
</div>
</div>
Set the max-width:1250px; that is currently on your body on your #container. This way your header will be 100% of his parent (body) :)
The best way to make the header full screen is set height to be 100vh
#header{
height: 100vh;
}
min-height: 100%;
position: relative;
set the body max-width:110%;
and the make the width on the header 110% it will leave a small margin on left that you can fiX with margin-left: -8px;
margin-top: -10px;
Remove the max-width from the body, and put it to the #container.
So, instead of:
body {
max-width:1250px;
}
You should have:
#container {
max-width:1250px;
}
just do
#RandomDiv{
width: 100%;
}
html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"
</head>
<body>
<ul class="menu">
<li>My Dashboard
<ul>
<li>Learn</li>
<li>Teach</li>
<li>My Library</li>
</ul>
</li>
<li>Likes
<ul>
<li>Pictures</li>
<li>Audio</li>
<li>Videos</li>
</ul>
</li>
<li>Views
<ul>
<li>Documents</li>
<li>Messages</li>
<li>Videos</li>
</ul>
</li>
<li>account
<ul>
<li>Sign In</li>
<li>Register</li>
<li>Deactivate</li>
</ul>
</li>
<li>Uploads
<ul>
<li>Pictures</li>
<li>Audio</li>
<li>Videos</li>
</ul>
</li>
<li>Videos
<ul>
<li>Add</li>
<li>Delete</li>
</ul>
</li>
<li>Documents
<ul>
<li>Upload</li>
<li>Download</li>
</ul>
</li>
</ul>
</body>
</html>
css:
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
body{
max-width:110%;
margin-left:0;
}
.menu {
height: 40px;
width:110%;
margin-left:-4px;
margin-top:-10px;
background: #4c4e5a;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.menu li {
position: relative;
list-style: none;
float: left;
display: block;
height: 40px;
}
.menu li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #393942;
border-right: 1px solid #4f5058;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #f3f3f3;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { color: #8fde62; }
.menu ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
.menu li:hover > ul { opacity: 1; }
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
.menu li:hover > ul li {
height: 36px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 100px;
padding: 4px 0 4px 40px;
margin: 0;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a { border: none; }
demo here
try also resizing the browser tab to see it in action