Overflow-y hides my absolute positioned element - html

I have a vertical nav menu and i want it to have scroll on y axis,because its for mobile users.Plus that i want menu to show on click of a icon which is absolute positioned to the menu.But when icon get out of the parent div it dissapears.And yes i readed a lot about this problem,and all guys saying that you must set position to relative on parent div,but in my case my parent div is position:fixed;.I tried to make a outer div of this one and set position to relative,but it didn't work.. ;(Here is my code:
/*-----------------------------------------------
Mobile Icon Style.
-----------------------------------------------*/
.mobile-icon{
position:absolute;
display:block;
width: 40px;
z-index:5;
right:-50px
}
.mobile-icon:before{
width: 100%;
font-size:2em;
font-family: "ElegantIcons";
font-weight: bold;
text-align: center;
content: "\64";
}
.mobile-icon:hover{
color:white;
background:black;
}
/*-----------------------------------------------
Mobile Menu Style.
-----------------------------------------------*/
.mobile-menu{
overflow-y:scroll;
position:fixed;
height:100%;
width:70%;
background:white;
z-index:1000;
transform: translate3d(0 ,0 ,0);
transition:transform 0.4s ease;
}
.active-mobile-menu div{
transform:translate3d:(0, 0, 0);
}
.active-mobile-menu .mobile-menu{
transform:translate3d(100% ,0 ,0);
}
.mobile-menu ul{
top:10.2%;
color:black;
text-align:left;
font-weight:bold;
position:relative;
}
.mobile-menu li a {
display:block;
padding: 4% 0;
border-bottom:1px solid black;
}
.mobile-menu > ul> li:hover > a, .mobile-menu > ul> li:hover > .sub-menu > li:hover > a, .mobile-menu > ul .sub-menu .sub-menu > li:hover > a{
background-color: #111;
color: #fff;
}
.mobile-menu ul li ul{
height:100%;
width:100%;
visibility:hidden;
display:none;
opacity:0;
transition:visibility 0s, opacity 0.5s linear;
background:#fff;
border:none;
position:relative;
}
.mobile-menu ul li:hover ul{
display:block;
opacity:1;
visibility:visible;
}
<div class="mobile-menu">
<span class="mobile-icon"></span>
<header class="mobile-header">
<div class="mobile-branding">
<!--My Logo script is here -->
</div>
</header>
<ul class="mobile-menu-ul">
<div class="caret"></div>
<?php wp_nav_menu(array(
'theme_location'=>
This is the menu List
1.
2.
</ul>
</div>

Related

List menu hover & active text color can't be changed despite background color changing

I keep trying to change the hover/active text color of my drop down menu to #8AE4E6. However, for some reason it isn't work. I tried adding color:#8AE4E6 under the background-color line but it doesn't seem to change. Also, for some reason my links are purple and orange once active. I don't see in my code every setting these colors. Is this the default? My color for body is white.
Thanks!
Here's the HTML and CSS
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" type="text/css" href="style2.css"/>
<title>SITETEST</title>
</head>
<body>
<div id="bottom"></div>
<div id="surround"></div>
<p id="bottomtext">A - W O R K - I N - P R O G R E S S</p>
<p id="title">YLDNA'S SITE</p>
<nav id="primary_nav_wrap" >
<ul>
<li class="hvr-fade">HOME</li>
<li class="hvr-fade" >INTRODUCTION</li>
<li class="hvr-fade">COMMITTEES
<ul>
<li class="hvr-fade">Security Council</li>
<li class="hvr-fade">CDIS</li>
</ul>
</li>
<li class="hvr-fade"><a href="#">EXECUTIVES</li>
<li class="hvr-fade">NEWS</li>
<li class="hvr-fade">CONTACT</li>
</ul>
</nav>
</body>
</html>
html{
min-height:100%;
background-size:cover;
background-attachment: fixed;
body {
font-family: 'telegrafico';
font-size: 1.1em;
text-align: center;
text-decoration:none;
display:inline;
max-width: 100%;
background-color:#8AE4E6;
background-size:cover;
color:white;
}
#primary_nav_wrap
{
margin-top:15px;
}
#primary_nav_wrap ul
{
list-style:none;
position:absolute;
float:left;
margin:0;
top:100%;
left:27.5%;
padding:0;
max-width:50%;
min-width:50%;
max-height:500px;
min-height:21%;
color:white;
}
#primary_nav_wrap ul a
{
display:block;
text-decoration:none;
font-weight:700;
font-size:12px;
line-height:32px;
padding:0 15px;
font-family: 'open sans';
font-size: 0.9em;
font-weight:200;
text-align:center;
}
#primary_nav_wrap ul li
{
position:relative;
float:left;
margin:0;
padding:0
}
#primary_nav_wrap ul ul
{
display:none;
position:absolute;
top:106%;
left:-25%;
padding:0px;
text-align:left;
}
#primary_nav_wrap ul ul li
{
float:left;
width:190px;
}
#primary_nav_wrap ul ul a
{
line-height:120%;
padding:10px 0px;
}
#primary_nav_wrap ul ul ul
{
top:0;
left:100%
}
#primary_nav_wrap ul li:hover > ul
{
display:block;
}
.hvr-fade {
display: inline-block;
border-radius: 0px;
color: #8AE4E6;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: color, background-color;
transition-property: color, background-color;
color: #8AE4E6;
}
.hvr-fade:hover, .hvr-fade:focus, .hvr-fade:active {
background-color:white;
color:#8AE4E6;
}
The links colors are not changing because you are not targeting the links.
Change your code to this -
/* target anchors*/
.hvr-fade a:hover, .hvr-fade a:focus, .hvr-fade a:active {
background-color:white;
color:#8AE4E6;
}
/* target anchors*/
Also close the style for html{}
html{
min-height:100%;
background-size:cover;
background-attachment: fixed;
} /* missing curly bracket in your question*/
Hope this help you.

Css : Image overlap the Dropdown menu issue?

I have a problem about the image overlap the dropdown menu that I can't hover.
The image I use -webkit-animation. When it rotate to the menu the dropdown will disable.
How can I let the rotate image doesn't effect the dropdown menu work.
I tried z-index and the image layer was lower than menu but dropdown menu still didn't work when mouse hover the gray image.I want the menu right to use. Any solution?
Please help.
Here is my code & Fiddle http://jsfiddle.net/bNBp3/130/
ul#main-navigation {
display:block;
border-bottom:1px solid #ccc;
margin:0 auto 0px auto;
min-height:21px;
padding:0;
width:100%;
clear:both;
}
ul#main-navigation li {
display:block;
float:left;
list-style:none;
margin:0 5px 0 0;
padding:0;
position:relative;
min-height:22px;
min-width:30%;
}
ul#main-navigation li a {
color:#000;
display:block;
padding:2px;
text-decoration:none;
}
ul#main-navigation li a.current, ul#main-navigation li a.section {
color:#fff;
}
ul#main-navigation li ul {
background:#eee;
position:absolute;
left:-1px;
top:21px;
display:none;
overflow:hidden;
padding:0px;
z-index:5;
width:100%;
border:1px solid #ccc;
}
ul#main-navigation li ul li {
display:block;
float:none;
margin:0;
width:100%;
border-bottom:1px solid #ccc;
}
ul#main-navigation li ul li a {
background:#eee;
display:block;
color:#333;
zoom:100%;
}
ul#main-navigation li ul li a:hover {
background:#fff;
}
ul#main-navigation li:hover {
background:#eee;
border-left:1px solid #ccc;
border-right:1px solid #ccc;
}
ul#main-navigation li:hover a.current {
background:#eee; color:#000;
}
ul#main-navigation li:hover ul {
display:block;
}
div#mcake{
display:block;
overflow: hidden;
background-color:#ccc;
background-repeat: no-repeat;
position:absolute;
left:200px;
left:-250px\9;
top:10px;
top:100px\9;
width:200px;
height:200px;
-webkit-animation:airplane-wiggle 30s ease infinite;
}
#-webkit-keyframes airplane-wiggle
{
from{-webkit-transform:rotateX(0deg) rotateY(5deg) rotateZ(5deg);}
50%{-webkit-transform:rotateX(-40deg) rotateY(-5deg) rotateZ(-10deg);}
to{-webkit-transform:rotateX(0deg) rotateY(5deg) rotateZ(5deg);}
}
maybe you could give the image a: z-index: -10; (or something like that) in your css.
I dont know if this will work but its worth the try.
I think the standard z-index is 0 so now your image and menu are on the same "layer". i think putting it on -10 will work
you could use margin-top in mcake to push the image down
div#mcake{
margin-top: 100px;
display:block;
overflow: hidden;
background-color:#ccc;
background-repeat: no-repeat;
position:absolute;
left:200px;
left:-250px\9;
...
}
I think the z-index would resolve your problem , along with this you should add the below code in your css section for this to be working in all browsers,
add animation:airplane-wiggle 30s ease infinite; in div#mcake.
div#mcake{
.......
........
....
-webkit-animation:airplane-wiggle 30s ease infinite;
animation:airplane-wiggle 30s ease infinite;
}
and #keyframes
#keyframes airplane-wiggle
{
from{transform:rotateX(0deg) rotateY(5deg) rotateZ(5deg);}
50%{transform:rotateX(-40deg) rotateY(-5deg) rotateZ(-10deg);}
to{transform:rotateX(0deg) rotateY(5deg) rotateZ(5deg);}
}

CSS z-index property for a drop down menu bar

I have a drop down menu bar. But it is always behind my content no matter how high I set the z-index of the bar or if I set the z-index of my content to -1. Can anybody help?
I did set the z-index to 500 where I do the hover of my navigation top menu but no change. Could it be because of the reset code I use in the beginning of my CSS code?
Here is my CSS Code:
/*navigation.xhtml; author: Mica */
#navigation {
float:left;
width:100%;
height:18px;
margin:15px 0 25px;
}
#navigation ul {
list-style-type:none;
list-style-image:none;
padding:0px;
float:left;
width: 100%;
}
#navigation li.topmenu {
float:left;
width:170px;
}
.topmenu a {
float:left;
width:100%;
text-align:center;
}
.topmenu ul {
float:left;
display:none;
width:100%;
}
.topmenu a, .submenu a, .topmenu:hover .submenu a {
padding:3px 0;
border:1px solid #C27000;
color:#FFFFFF;
font-weight:bold;
text-decoration:none;
background-color:#FF8C00;
margin:0;
font-weight:bold;
}
.submenu a{
width:100%;
clear:both;
postition:absolute;
}
#navigation a:hover, .topmenu.on a, .topmenu:hover a {
background-color:#FFA500;
}
.topmenu:hover ul {
display:block;
z-index:500;
}
#logo a:hover {
opacity:0.8;
}
/*content in basicTemplate.xhtml; author: Mica */
#content {
float:left;
min-height:200px;
margin:0 7px;
}
HAHAAA found it!
z-index only works when a position is declared first: so I need to set in this block a position:
.topmenu:hover ul {
display:block;
z-index:500;
}
Like here:
.topmenu:hover ul {
display:block;
position:relative;
z-index:500;
}

How to make border focused under menu on css?

I am pretty new on css and I want to learn use css effectively but I have now couple of problems/questions, I want to make grey border under my menu but when I zoom in and out border behave so strangely? Sorry my code is not very clean. And how can I retouch my code for better standing?
HTML
<html>
<head>
<link href="Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
span{
color:#d00000;
text-decoration:underline;
}
#home{
background-color:#0000CC;
}
span{
font-style:italic;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<ul>
<li><span>Home</span></li>
<li>link2</li>
<li>link3
<ul>
<li>sub</li>
<li>sub2</li>
</ul>
</li><!---End of DropDown Videos menu--->
<li>link4</li>
<li>link5</li>
</ul><!---End of nav elements--->
<br class="clearFloat">
</div><!---End of header--->
</div><!---End of wrapper--->
<div id="grey">
</body>
</html>
CSS
#wrapper{
float:center;
}
#grey{
border-bottom:250px solid #a0a0a0;
padding:0px;
margin-left:203px;
margin-right:387px;
}
#header{
margin:auto;
padding:0px;
clear:both;
}
#header ul{
margin:0px;
padding:0px;
line-height:30px;
}
#header li{
margin:0px;
padding:0px;
list-style: none;
float:left;
position:relative;
background-color:#000099;
border:1 solid #0000CC;
top:px;
right:-15%;
}
#header ul li a{
text-align:center;
font-family:fantasy;
text-decoration:none;
display:block;
height:30px;
width:150px;
color:black;
}
#header ul ul li a{
color:#0000cc;
}
#header ul ul li{
right:0%;
}
#header ul ul{
margin:0px;
padding:0px;
position:absolute;
opacity: 0;
visibility: hidden;
transition: all .1s ease-in;
}
#header ul li:hover ul {
visibility:visible;
opacity:1 ;
}
#header ul li:hover {
background-color:blue;
}
#header ul li:hover a {
color:black;
}
#header ul ul li:hover a {
color:#d00000;
}
.clearfloat{
clear:both;
margin:0px;
padding:0px;
}
Without completely reworking your code, just think of added a bottom border per 'li'...
Remove your id='grey' and add your border-bottom to your #header li {}. Refresh but note how your 'sub' menus then each have a bottom border now. They inherited it, so you then need to turn those off...hence add border-bottom: none to the #header ul ul li declaration.
Now...if we did a quick rework of your code...
HTML
<div id="wrapper">
<div id="header">
<div id="navwrapper">
<ul id="nav">
<li><span>Home</span></li>
<li>link2</li>
<li>link3
<ul class="sub">
<li>sub</li>
<li>sub2</li>
</ul>
</li>
<li>link4</li>
<li>link5</li>
</ul>
</div>
</div>
CSS
html, body { margin:10px;padding:0; }
#wrapper, #header, #navwrapper { margin: 0 auto 0 auto; }
#nav {
padding:0;
margin: 0 auto 0 auto;
line-height:30px;
height:30px;
list-style:none }
#nav li {
border-bottom: solid #a0a0a0 10px;
margin:0;
padding:0;
float:left;
background-color:#000099;
}
#nav a {
text-align:center;
font-family:fantasy;
text-decoration:none;
display:block;
height:30px;
width:150px;
color:black;
}
#nav li:hover { background-color:blue; }
#nav li:hover .sub {
visibility:visible;
opacity: 1;
}
#nav .sub a { color:#00c; }
#nav .sub {
margin:0;
padding:0;
position:absolute;
opacity: 0;
visibility: hidden;
transition: all .1s ease-in;
list-style: none;
}
#nav .sub li { clear:both; border-bottom: none; }
Using more naming conventions with your sub menus is safer than just drilling down through the css. You also need to note that any top-level CSS declaration is inherited by all the children within. Such that if you declare #nav li as being black but want all the 'sub' list elements to be blue, that needs to be stated explicitly...AFTER the initial declaration in the CSS document.
Hope this helped...

Sprite nav menu rendering incorrectly in IE when the page is reloaded

I am having an issue with my site. I have a nav vertical menu that works well in all browsers. I have it set so that when you hover over the image, it shifts position to display the on hover image (like a sprite). However, in IE9 and IE9 in compatibility mode, when I click on one of the links and navigate away from the page and then click back to return to the page, IE puts the on hover image sprite of the last item in the menu as the first image in the menu. It is only when you click the page that this corrects itself. Below is the css.
#nav{
clear:both;
float:left;
width:200px;
margin-right:20px;
}
/*.menu li{
height:28px;
overflow:hidden;
margin-bottom:10px;
}
.menu a:link{
position:relative;
top:0;
}
.menu a:hover{
top: -28px;
}*/
.menu {
position:relative;
margin-left:-10px;
}
.menu li{
/*height:30px;
overflow:hidden;
margin-bottom:10px;*/
margin:10px;
padding:0;
list-style:none;
top:0;
}
.menu li a{
/*height:60px;*/
display:block;
}
.btnPromodirect a{
height:28px;
width:200px;
background:url('../links/promodirect_button.jpg') 200px 0;
}
.btnPromotionmag a{
height:28px;
width:200px;
background:url('../links/promotionmagazine_button.jpg') 200px 0;
}
.btnPromota a{
height:28px;
width:200px;
background:url('../links/promota_button.jpg') 200px 0;
}
.btnPpib a{
height:28px;
width:200px;
background:url('../links/ppib_buton.jpg') 200px 0;
}
.btnPromodirect, .btnPromotionmag, .btnPromota, .btnPpib{
border: none !important;
outline: none !important;
}
.btnPromodirect a:hover, a:active{
background:url('../links/promodirect_button.jpg') 0 -28px;
}
.btnPromotionmag a:hover, a:active{
background:url('../links/promotionmagazine_button.jpg') 0 -28px;
}
.btnPromota a:hover, a:active{
background:url('../links/promota_button.jpg') 0 -28px;
}
.btnPpib a:hover, a:active{
background:url('../links/ppib_buton.jpg') 0 -28px;
}
below is the html
<div id="nav">
<ul class="menu">
<li class="btnPromodirect"></li>
<li class="btnPromotionmag"> </li>
<li class="btnPromota"></li>
<li class="btnPpib"></li>
</ul>
</div>
</div>
I am fairly new to this so any help would be greatly appreciated.
Whereever you are using background like..
background:url('../links/promodirect_button.jpg') 200px 0;
Add no-repeat as well...
background:url('../links/promodirect_button.jpg') 200px 0 no-repeat;
Try this and let me know if it helps ...