I have some problem with my CSS :
My coding so far :
#leftcolumn {
background: url('SlicingImage/action_bar.jpg');
background-repeat:none;
float:left;
z-index: -1;
}
HTML:
<div id="containerleft">
<div id="leftcolumn" >
<p><img src="SlicingImage/alacards_logo.png"/></p>
<ul>
<li class="separator"></li>
<li class="buttons">home</li>
<li class="separator"></li>
<li class= "buttons">users</li>
<li class="separator"></li>
<li class= "buttons">tutorial</li>
<li class="separator"></li>
<li class= "buttons">issuers</li>
<li class="separator"></li>
<li class= "buttons">merchants</li>
<li class="separator"></li>
<li class= "buttons">partners</li>
<li class="separator"></li>
<li class= "buttons">high light</li>
<li class="separator"></li>
<li class= "buttons">news</li>
<li class="separator"></li>
<li class= "buttons">contact us</li>
<li class="separator"></li>
<li class="bottom"></li>
</ul>
</div>
</div>
If I run this code, result : BG but I want that small gray area covered like this
If I delete
background: url('SlicingImage/action_bar.jpg');
become like BG2
I tried add that class="bottom", but not like what I want (must define height manually)
Your background it is not showing because the z-index. Try to put a higher one
Try giving width to your ul and margin:auto;
ul {
list-style-type: none;
margin: auto;
overflow: hidden;
padding: 0;
position: relative;
width: 750px;
}
Works for me:
#leftcolumn {
background: url(https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTFMUprTNP6nK2r2QxbZ-ls7YlgiVenNuwCBkXwX-keeE96iOradptCHPLZ);
background-repeat:none;
float:left;
z-index: -1;
}
It must be something odd in your button and/or separator classes.
NOTE: I used some random pink background image that I found with Google image search.
I found the solution: After I put </p> after </ul>, will give me the result I want
<div id="containerleft">
<div id="leftcolumn" >
<p><img src="SlicingImage/alacards_logo.png"/>
<ul>
<li class="separator"></li>
<li class="buttons">home</li>
<li class="separator"></li>
<li class= "buttons">users</li>
<li class="separator"></li>
<li class= "buttons">tutorial</li>
<li class="separator"></li>
<li class= "buttons">issuers</li>
<li class="separator"></li>
<li class= "buttons">merchants</li>
<li class="separator"></li>
<li class= "buttons">partners</li>
<li class="separator"></li>
<li class= "buttons">high light</li>
<li class="separator"></li>
<li class= "buttons">news</li>
<li class="separator"></li>
<li class= "buttons">contact us</li>
<li class="separator"></li>
<li class="bottom"></li>
</ul>
</p>
</div>
</div>
Related
Here i have the menu structure, what am i trying to do is that, when i click the parent level item or any sub menu item the class active is going to get added to the menu which is clicked.
i want to change the color of only the parent menu item but not the sub menu item, how can i do that. right now what is happening is that i have applied css, but its getting applied to parent menu as well as the child menu items.
.center-in-menu {
&:not(div.we-mega-menu-submenu) {
.we-mega-menu-li.active {
a {
color: blue !important;
}
}
}
}
<ul class="nav-tabs center-in-menu">
<li class="we-mega-menu-li dropdown-menu">
Menu 1
<div class="we-mega-menu-submenu">
<ul class="nav-tabs">
<li class="we-mega-menu-li">submenu1</li>
<li class="we-mega-menu-li dropdown-menu">submenu2</li>
<div class="we-mega-menu-submenu">
<ul class="nav-tabs">
<li class="we-mega-menu-li">submenu1</li>
<li class="we-mega-menu-li">submenu1</li>
<li class="we-mega-menu-li">submenu1</li>
<li class="we-mega-menu-li">submenu1</li>
<li class="we-mega-menu-li">submenu1</li>
</ul>
</div>
<li class="we-mega-menu-li">submenu3</li>
<li class="we-mega-menu-li">submenu4</li>
<li class="we-mega-menu-li">submenu5</li>
</ul>
</div>
<li class="we-mega-menu-li">Menu 2</li>
<li class="we-mega-menu-li">Menu 3</li>
<li class="we-mega-menu-li dropdown-menu">
Menu 4
<div class="we-mega-menu-submenu">
<ul class="nav-tabs">
<li class="we-mega-menu-li">submenu1</li>
<li class="we-mega-menu-li active dropdown-menu">submenu2</li>
<div class="we-mega-menu-submenu">
<ul class="nav-tabs">
<li class="we-mega-menu-li active">submenu1</li>
<li class="we-mega-menu-li">submenu2</li>
<li class="we-mega-menu-li">submenu3</li>
<li class="we-mega-menu-li">submenu4</li>
<li class="we-mega-menu-li">submenu5</li>
</ul>
</div>
<li class="we-mega-menu-li">submenu3</li>
<li class="we-mega-menu-li">submenu4</li>
<li class="we-mega-menu-li">submenu5</li>
</ul>
</div>
</li>
<li class="we-mega-menu-li">Menu 5</li>
</ul>
Example here
https://codepen.io/Chandanay/pen/YzKJNEE
Use > to apply styles only to elements inside the given selector without going deeper any further.
Here's an example:
div.wrapper > a { /* only applied to direct children */
font-weight: bold;
}
div.inner a {
font-style: italic;
}
<div class="wrapper">
<a>1st Level (Bold)</a>
<div class="inner">
<a>2nd Level (Italic)</a>
</div>
<div class="noclass">
<a>2nd Level (No style)</a>
</div>
</div>
I have 5 side by side lists in my website's footer as follows:
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
What I would like to happen is that at any resolution below 992px, the lists will each take up 50% of the column creating 3 rows of 2 lists each except for the last (since I have 5 lists)
Here is my sass code: (maxMQ is just a mixin for a media query and $md-max-width is 992px)
.footer {
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
#include maxMQ($md-max-width) {
margin-top: 30px;
width: 50%;
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
a {
color: #ffffff;
text-decoration: none;
cursor: pointer;
}
}
}
The problem is that when I reduce resolution below 992px (mobile/tablet), the 3rd list skips a spot on the second row. so it looks something like this:
row 1: list list
row 2: list
row 3: list list
What I want is:
row 1: list list
row 2: list list
row 3: list
I have no idea why this is happening. I do know that when I remove the ul's from within the 'links' divs it works fine.
Any help would be greatly appreciated! Thanks!
This is due to the floating elements, the first element has more height than the second one and it's creating this issue on the second row.
To fix this and you can use flex and remove the floating:
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.footer-links {
display: flex;
flex-wrap:wrap;
}
.links {
margin-top: 30px;
width: 50%;
float: none;
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
Or simply remove floating without adding flex but you need to fix white spaces issue to have them 50% width:
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.footer-links {
font-size: 0; /* remove white spaces */
}
.links {
margin-top: 30px;
width: 50%;
float: none;
font-size: initial; /* put back font as initial*/
vertical-align:top;
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
Or you can simply add a min-height to your elements to be sure they have the same height:
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.links {
margin-top: 30px;
width: 50%;
min-height:170px; /* adjust this value with want you what*/
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
Another easy fix for your situation is to clear floating after each last element of each row by using clear:left (but you need to adjust this if you change your logic, for example 3 per row instead of 2 per row):
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.links {
margin-top: 30px;
width: 50%;
}
/* Added this code*/
.links:nth-child(2n+1) {
clear:left;
}
/**/
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
inline-block automatically adds some margin to the elements, I believe around 4px. So 50% plus that 4px will make it more than 100%, pushing down the elements. Try changing to just block instead.
I'm currently stuck, I'm trying to make a div take 100% height with 100vh (position fixed is not an option). It works, but only for the active window, when we scroll, the div stop taking 100% height.
I've searched on the other topics, and I tried min-height : 100vh, also tried put position relative and min-height: 100% on html and body tags, but it doesn't work for me.
Maybe I have to specify that I'm using bootstrap 3.
HTML
<div id="bel-menu" class="col-sm-3 col-md-2 col-lg-2">
<ul id="custom-menu" class="nav nav-pills nav-stacked" role="menu" aria-labelledby="dropdownMenu">
<li role="presentation" class="groupe-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">Groupe</a>
<div class="menu-arrow"></div>
<ul class="dropdown-menu secondary-menu">
<li class="">Groupe</li>
<li class="">Mission</li>
<li class="">Marques et produits</li>
<li class="">Engagements</li>
<li class="">Temps forts</li>
<li class="">Implantations</li>
<li class="">Bel dans le monde</li>
<li class="">Finance</li>
<li class="">Gouvernance</li>
<li class="">Présenter Bel</li>
</ul>
</li>
<li class="workplace-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Workplace
<div class="menu-arrow"></div>
</li>
<li class="documents-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Documents
<div class="menu-arrow"></div>
</li>
<li class="moi-chez-bel-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Moi chez Bel
<div class="menu-arrow"></div>
</li>
<li class="applications-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Applications
<div class="menu-arrow"></div>
</li>
</ul>
<div class="col-sm-3 col-md-2 col-lg-2 nopad open-btn">
<div class="arrow-icon"></div>
</div>
</div>
CSS
#bel-menu {
height: 100vh;
padding: 0;
background-color: #333;
}
Take a look to my project : https://jsfiddle.net/e94wewad/
The div I'm talking about is the one, that is containing the lateral menu.
The menu is taking 100% of the viewport, but when I scroll down, it stops.
I'm using slickNav and its not properly reading my nested list.
This page is a repository for NPCS for a Table top RPG.
The top level is general information and organizes NPCs by location.
The second level organizes NPCs by rarity level
and the third level is the NPC's themselves.
Now interestingly, slickNav displays levels 1 and 2 just fine, but level 3 opens up to invisible text. I say invisible text because the amount of space that is revealed by the dropdown is correct.
This GIF shows what i'm talking about.
Observe how I click on Domestic animals, according the code below you can this is a long list of NPCs. The space SlickNav drops down is large.
Then observe how I click under Eol, this part of the site is undeveloped still, and so its only list item is " coming soon". Accordingly slickNav only drops down a little to make enough space for that.
According to http://slicknav.com/, it seems ive correctly nested my structure and labeled the menu as class="menu".
Its worth noting that on other parts of the site this menu works fine, but the menu's on those parts of the site are maximum of two levels deep.
Here is my HTML: Warning this is a big menu
<div class ="menu_wrap">
<nav id = "navMenu">
<ul class = "menu clearfix">
<li>Home
<ul class='subMenu1'>
<li id="instr">Instructions</li>
</ul>
</li>
<li>General
<ul class="subMenu1" >
<li>Domestic Animals
<ul class="subMenu2">
<li id="da1">Camel</li>
<li id="da2">War Camel</li>
<li id="da3">Druldon</li>
<li id="da4">Donkey</li>
<li id="da5">Pony</li>
<li id="da6">Draft Horse</li>
<li id="da7">Saddle Horse</li>
<li id="da8">Light War Horse</li>
<li id="da9">Heavy War Horse</li>
<li id="da10">Chariot Horse</li>
<li id="da11">Voran War Horse</li>
<li id="da12">Elven Narathi</li>
<li id="da13">Mountain Ram</li>
<li id="da14">War Elephant</li>
<li id="da15">War Mammoth</li>
<li id="da16">Dovashi Mastiff</li>
</ul>
</li>
<li>Common NPCs
<ul class="subMenu2">
<li id="guard1">Guard: Dovashi</li>
<li id="guard2">Guard: Dwarven</li>
<li id="guard3">Guard: Elven</li>
<li id="guard4">Guard: Gamoran</li>
<li id="guard5">Guard: Salatai</li>
<li id="guard6">Guard: Voran</li>
<li id="guard7">Guard: Dark Elf</li>
<li id="c5">Gnoll</li>
<li id="c6">Grimlock</li>
<li id="c11">Roper</li>
<li id="c12">Skeleton</li>
<li id="c13">Giant Spider</li>
<li id="c15">Zombie</li>
</ul>
<li>Uncommon NPCs
<ul class= "subMenu2">
<li id="uc5">Fire Child</li>
<li id="uc6">Ghoul</li>
<li id="uc11">Rakasa</li>
</ul>
</li>
<li>Rare NPCs
<ul class= "subMenu2">
<li id="r1">Adherer</li>
<li id="uc24">Arcane</li>
<li id="r3">Bane Dead</li>
<li id="r5">Fire Lord</li>
<li id="eleGen">Generic Elementalist</li>
<li id="necGen">Generic Necromancer</li>
<li id="illGen">Generic Illusionist</li>
<li id="cleGen">Generic Cleric</li>
<li id="r8">Radasai Warrior</li>
<li id="r9">Elemental(Fire)</li>
<li id="r10">Elemental(Water)</li>
<li id="r11">Elemental(Earth)</li>
<li id="r12">Elemental(Air)</li>
</ul>
</li>
<li>Very Rare NPCs
<ul class="subMenu2">
<li id="vr1">Arch Shadow</li>
<li id="vr3">Gorgon</li>
<li id="vr4">Illithid</li>
<li id="new3">Vampire</li>
<li id="new4">Were Wolf</li>
</ul>
</li>
</ul>
</li>
<li id ="world_drop"> Wol
<ul class ="subMenu1" >
<li>Common NPCs
<ul class="subMenu2">
<li id="c1">Cave Bear</li>
<li id="c2">Dire Wolf</li>
<li id="c3">Echuyan</li>
<li id="c4">Goblin</li>
<li id="c7">Voran Raider</li>
<li id="c8">Dovashi Ronin</li>
<li id="c9">Naga</li>
<li id="c10">Orc</li>
<li id="c14">Umber Hulk</li>
</ul>
</li>
<li>Uncommon NPCs
<ul class="subMenu2">
<li id="uc1">Ant (Giant)</li>
<li id="uc2">Alaghi</li>
<li id="uc3">Centaur</li>
<li id="uc4">Dire Boar</li>
<li id="uc7">Ogre</li>
<li id="uc8">Orc(Black)</li>
<li id="uc9">Orc (Shaman)</li>
<li id="uc10">Owl Bear</li>
<li id="uc12">Rastipede</li>
<li id="uc13">Troll</li>
<li id="new1">Young Black Wyvern</li>
</ul>
</li>
<li>Rare NPCs
<ul class="subMenu2">
<li id="r2">Ant Lion( giant)</li>
<li id="new2">Adult Black Wyvern</li>
<li id="r4">Basilisk</li>
<li id="r6">Hill Giant</li>
<li id="r7">Naga Elite</li>
</ul>
</li>
<li>Very Rare NPCs
<ul class="subMenu2">
<li id="vr2">Dray</li>
<li id="vr5">kalin</li>
<li id="vr6">Naga Queen</li>
<li id="vr7">Minotaur</li>
</ul>
</li>
</ul>
</li>
<li> Nol
<ul class="subMenu1">
<li>Common NPCs
<ul class="subMenu2">
<li id="c16">Abrian</li>
<li id="c17">Cave Bear (Polar)</li>
<li id="c18">Dwarven Bandits</li>
<li id="c19">Ettin</li>
<li id="c20">Frost Orc</li>
<li id="c21">Tus'Khul</li>
<li id="c22">Icemaw Raiders</li>
<li id="c23">Kenku</li>
<li id="c24">Kobold</li>
<li id="c25">Tundra Stag</li>
<li id="c26">Wight</li>
</ul>
</li>
<li>Uncommon NPCs
<ul class="subMenu2">
<li id="uc14">Bainligor</li>
<li id="uc15">Ettin (Mage)</li>
<li id="uc16">Blue Orc</li>
<li id="uc17">Goatmen</li>
<li id="uc18">Ice Golem</li>
<li id="uc19">Rogue ClockWork</li>
<li id="uc20">Snow Serpent</li>
<li id="uc21">Ice Wyvern(Young)</li>
<li id="uc22">Voldun</li>
</ul>
</li>
<li>Rare NPCs
<ul class="subMenu2">
<li id="r13">Aviarag</li>
<li id="r14">Crystal Hydra</li>
<li id="r15">Dark Hood</li>
<li id="r16">Derro Warrior</li>
<li id="r17">Frost Giant</li>
<li id="r18">Gargoyle</li>
<li id="r19">Ice Wyvern(Adult)</li>
<li id="r20">Mammoth</li>
</ul>
</li>
<li>Very Rare NPCs
<ul class="subMenu2">
<li id="vr8">White Dragon</li>
<li id="vr9">Pit Horror</li>
<li id="vr10">Frozen Men</li>
<li id="vr11">Vaporighu</li>
</ul>
</li>
</ul>
<li id ="indie_drop"> Sol
<ul class="subMenu1">
<li>Common NPCs
<ul class="leftSubMenu2">
<li id="c27">Cistern Fiend</li>
<li id="c28">Dire Crocodile</li>
<li id="c29">Dire Lion</li>
<li id="c30">Gamoran Exiles</li>
<li id="c31">Giant Scorpion</li>
<li id="c32">Myconid</li>
<li id="c33">Sand Bones</li>
<li id="c34">Salatai Bandits</li>
<li id="c35">Shissai half Breed</li>
<li id="c36">Tus-Kowah</li>
</ul>
</li>
<li>Uncommon NPCs
<ul class="leftSubMenu2">
<li id="uc23">Amiq-Rasol</li>
<li id="uc25">Beholder-Kin</li>
<li id="uc26">Gremlin</li>
<li id="uc27">Lesser Salamander</li>
<li id="uc28">Mummy</li>
<li id="uc29">Scrab</li>
<li id="uc30">Spell-Sword Merc.</li>
<li id="uc31">Shissai Pure Blood</li>
<li id="uc32">Will-O-Wisp</li>
</ul>
</li>
<li>Rare NPCs
<ul class="leftSubMenu2">
<li id="r21">Assimar</li>
<li id="r22">Elephant</li>
<li id="r23">Hattori</li>
<li id="r24">Roc</li>
<li id="r25">Sand-Men</li>
<li id="r26">Skordi</li>
<li id="r27">Tortle</li>
<li id="r28">Winged Snake</li>
</ul>
</li>
<li>Very Rare NPCs
<ul class="leftSUbMenu2">
<li id="vr12">Beholder</li>
<li id="vr13">Black Dragon</li>
<li id="vr15">Djinn</li>
<li id="vr14">Mummy Lord</li>
<li id="vr16">Sand Hydra</li>
</ul>
</li>
</ul>
</li>
<li> Eol
<ul class="subMenu1">
<li>Common NPCs
<ul class="leftSUbMenu2">
<li>Comming Soon</li>
</ul>
</li>
<li>Uncommon NPCs
<ul class="leftSUbMenu2">
<li>Comming Soon</li>
</ul>
</li>
</li>
<li>Rare NPCs
<ul class="leftSUbMenu2">
<li>Comming Soon</li>
</ul>
</li>
</li>
<li>Very Rare NPCs
<ul class="leftSUbMenu2">
<li>Comming Soon</li>
</ul>
</li>
</li>
</ul>
</li>
</ul>
This is all the CSS associated with the Menu.
Note: This is a simple CSS menu, the submenus are set to display:none and on hover the display is set to block.
All my menus work the same way on other parts of the site. But display being set to none is the only thing I can think of.
#navMenu{
margin:0;
padding: 0;
position: absolute;
line-height: 2em;
top: 28%;
left: 5.1%;
width: 100%;
font-size: 1.2vw;
font-family: verdana,arial,serif;
cursor: pointer;
z-index: 3;
}
#navMenu ul {
margin: 0;
padding: 0;
line-height: 2vw;
}
#navMenu li{
margin: 0;
padding: 0;
list-style: none;
float: left;
position: relative;
background: #999;
padding:.5em;
}
#navMenu ul li {
text-align: center;
text-decoration: none;
height: 1.875em;
width:13.5vw;
display: block;
color: #e0e0da;
background: black;
border-color: #99cdde;
border: 1px solid #99cdde;
}
.subMenu1,.subMenu2{
position: absolute;
display: none;
top: 100%;
left: -.25%; /*this fixes a menu alignment problem */
cursor: pointer;
}
.subMenu2{
position: absolute;
left: 100%;
top: 0%;
overflow-y: auto;
overflow-x:hidden;
height: 30vh;
}
.leftSubMenu2{
position: absolute;
right: 100%;
top: 0%;
overflow-y: auto;
overflow-x:hidden;
height: 30vh;
display: none;
}
#navMenu ul li:hover>ul {
display: block;
}
#navMenu ul li:hover{
transition:all linear .15s;
color: #99cdde;
}
I have menu like here https://jsfiddle.net/z93hy4gh/ .
.widget li:hover {
background:#002d5e;
}
<div class="widget">
<ul class="product-categories">
<li class="cat-item cat-item-7 cat-parent current-cat-parent">Odzież
<ul class="children">
<li class="cat-item cat-item-13">Bluzy białe</li>
<li class="cat-item cat-item-14">Bluzy 100% bawełna</li>
<li class="cat-item cat-item-22">Bluzy na trok</li>
<li class="cat-item cat-item-32">Spodnie kolorowe i białe</li>
<li class="cat-item cat-item-68">Spodnie 100% bawełna</li>
<li class="cat-item cat-item-33 current-cat">Spodnie białe</li>
</ul>
</li>
<li class="cat-item cat-item-43">Fartuch </li>
<li class="cat-item cat-item-44">Fartuch </li>
<li class="cat-item cat-item-8">Obuwie </li>
</ul>
</div>
I want to set background for hover elements. But I don't know how to set it for child elements. How can I use .cat-parent or .current-cat-parent class to fix it?
I am guessing a bit about what you want, but perhaps if you set the background color on the a elements, you can highlight each link without affecting a nested blocks of li's.
I am assuming that you want to highlight the link text for each link in the lists.
.widget .children li {
background-color: yellow; /* demo only... */
display: block;
}
.widget .children li:hover {
background: pink;
}
.widget .product-categories > li:hover:not(:first-child) {
background-color: lightgreen;
}
.widget .product-categories > li:first-child a:hover {
background-color: lightgreen;
display: block;
}
<div class="widget">
<ul class="product-categories">
<li class="cat-item cat-item-7 cat-parent current-cat-parent">Odzież
<ul class="children">
<li class="cat-item cat-item-13">Bluzy białe</li>
<li class="cat-item cat-item-14">Bluzy 100% bawełna</li>
<li class="cat-item cat-item-22">Bluzy na trok</li>
<li class="cat-item cat-item-32">Spodnie kolorowe i białe</li>
<li class="cat-item cat-item-68">Spodnie 100% bawełna</li>
<li class="cat-item cat-item-33 current-cat">Spodnie białe</li>
</ul>
</li>
<li class="cat-item cat-item-43">Fartuch </li>
<li class="cat-item cat-item-44">Fartuch </li>
<li class="cat-item cat-item-8">Obuwie </li>
</ul>
</div>
You can use css :not() to prevent .cat-parent.
$(document).ready(
function() {
$('.cat-parent').click(
function(event) {
event.preventDefault();
$(this).toggleClass('opened');
});
});
.widget li:not(.opened):hover {
background: #002d5e;
}
.children {
display: none;
}
.opened .children {
display: block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="widget">
<ul class="product-categories">
<li class="cat-item cat-item-7 cat-parent current-cat-parent">Odzież
<ul class="children">
<li class="cat-item cat-item-13">Bluzy białe
</li>
<li class="cat-item cat-item-14">Bluzy 100% bawełna
</li>
<li class="cat-item cat-item-22">Bluzy na trok
</li>
<li class="cat-item cat-item-32">Spodnie kolorowe i białe
</li>
<li class="cat-item cat-item-68">Spodnie 100% bawełna
</li>
<li class="cat-item cat-item-33 current-cat">Spodnie białe
</li>
</ul>
</li>
<li class="cat-item cat-item-43">Fartuch
</li>
<li class="cat-item cat-item-44">Fartuch
</li>
<li class="cat-item cat-item-8">Obuwie
</li>
</ul>
</div>