Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Google Pixel 9 Pro
vgp
Updated:
Today at 5:57 PM
Ad icon
Jobreceive.com for sale
Blogerwiki
Updated:
Tuesday at 8:55 PM
Post Your Vehicle for Sale — FREE! - https://libro.lk
Kalu_Puth
Updated:
Tuesday at 7:38 PM
ඔයාගෙ Assignment හෝ Thesis එක හරියට හදාගමු
ErMurazor
Updated:
Saturday at 10:52 PM
Ad icon
BlackWall V2ray servers
hu KANNA
Updated:
Sep 23, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
CSS උදව්වක් ඕනේ.. changing wordpress menu color on mobile
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Al Baik" data-source="post: 29091241" data-attributes="member: 326965"><p>you can use the CSS :hover pseudo-class selector along with nested CSS rules. This will allow you to apply different styles to the sub-menu items when the main menu is hovered.</p><p></p><p>Assuming you have a typical HTML structure for a navigation menu with sub-menus, here's how you can achieve it:</p><p></p><p>HTML:</p><p>[ICODE]</p><p><nav></p><p> <ul class="main-menu"></p><p> <li><a href="#">Home</a></li></p><p> <li></p><p> <a href="#">Products</a></p><p> <ul class="sub-menu"></p><p> <li><a href="#">Product 1</a></li></p><p> <li><a href="#">Product 2</a></li></p><p> <li><a href="#">Product 3</a></li></p><p> </ul></p><p> </li></p><p> <li><a href="#">About</a></li></p><p> <li><a href="#">Contact</a></li></p><p> </ul></p><p></nav></p><p></p><p>[/ICODE]</p><p></p><p></p><p>CSS:</p><p>[ICODE]</p><p>/* Styles for the main menu items */</p><p>.main-menu li a {</p><p> display: block;</p><p> color: #000; /* Change this to the desired color for the main menu items */</p><p> text-decoration: none;</p><p> padding: 10px;</p><p>}</p><p></p><p>/* Styles for the sub-menu items, initially hidden */</p><p>.sub-menu {</p><p> display: none;</p><p>}</p><p></p><p>/* Show the sub-menu on hover */</p><p>.main-menu li:hover .sub-menu {</p><p> display: block;</p><p>}</p><p></p><p>/* Styles for the sub-menu links */</p><p>.sub-menu li a {</p><p> color: #ff0000; /* Change this to the desired color for the sub-menu items */</p><p>}</p><p></p><p>[/ICODE]</p><p></p><p></p><p></p><p>In the CSS code above, we use the .main-menu li:hover .sub-menu selector to target the sub-menu when its parent (main menu item) is being hovered. This allows us to change the display property of the sub-menu and make it visible when the main menu item is hovered. The .sub-menu li a selector is then used to target the anchor tags within the sub-menu and change their color to the desired color.</p><p></p><p>Replace the #000 and #ff0000 with your preferred colors for the main menu and sub-menu items, respectively. This way, when you hover over a main menu item, its corresponding sub-menu will appear with the specified color for the sub-menu items.</p></blockquote><p></p>
[QUOTE="Al Baik, post: 29091241, member: 326965"] you can use the CSS :hover pseudo-class selector along with nested CSS rules. This will allow you to apply different styles to the sub-menu items when the main menu is hovered. Assuming you have a typical HTML structure for a navigation menu with sub-menus, here's how you can achieve it: HTML: [ICODE] <nav> <ul class="main-menu"> <li><a href="#">Home</a></li> <li> <a href="#">Products</a> <ul class="sub-menu"> <li><a href="#">Product 1</a></li> <li><a href="#">Product 2</a></li> <li><a href="#">Product 3</a></li> </ul> </li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> [/ICODE] CSS: [ICODE] /* Styles for the main menu items */ .main-menu li a { display: block; color: #000; /* Change this to the desired color for the main menu items */ text-decoration: none; padding: 10px; } /* Styles for the sub-menu items, initially hidden */ .sub-menu { display: none; } /* Show the sub-menu on hover */ .main-menu li:hover .sub-menu { display: block; } /* Styles for the sub-menu links */ .sub-menu li a { color: #ff0000; /* Change this to the desired color for the sub-menu items */ } [/ICODE] In the CSS code above, we use the .main-menu li:hover .sub-menu selector to target the sub-menu when its parent (main menu item) is being hovered. This allows us to change the display property of the sub-menu and make it visible when the main menu item is hovered. The .sub-menu li a selector is then used to target the anchor tags within the sub-menu and change their color to the desired color. Replace the #000 and #ff0000 with your preferred colors for the main menu and sub-menu items, respectively. This way, when you hover over a main menu item, its corresponding sub-menu will appear with the specified color for the sub-menu items. [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom