How to Design simple Menu with Sub-Menu in Html Css
code : https://github.com/AkajithAk/html-css...
HTML Structure
div class="header": This is the container for the menu, including a logo section and the navigation menu.
div class="logo": This contains the logo or title of the page, in this case, a simple "Hello" text.
ul class="menu": This is the main navigation menu using an unordered list (ul). Each item (li) represents a menu option.
li: Represents each menu item. Items like "Home," "Contact Us," and "Education" are simple menu items without sub-menus.
Sub-menu: Some menu items (like "Business" and "Blogs") have sub-menus. These sub-menus are also unordered lists (ul class "subMenu") nested within the main list items.
ul class="subMenu": This is used for the sub-menu items which are initially hidden. Items like "React," "Javascript," and "Angular" are sub-menu options under "Business" and "Blogs."
CSS Styling
Global Styles (body, h1, li):
margin: 0;: Removes default margin for these elements, ensuring a consistent starting point for layout.
Header (.header):
height: 60px;: Sets a fixed height for the header.
background: rgb(11, 104, 151);: Applies a blue background color.
display: grid;: Utilizes CSS Grid to layout the header.
grid-template-columns: 20% 80%;: Divides the header into two sections, 20% for the logo and 80% for the menu.
align-items: center;: Vertically centers the content within the grid.
Menu (.menu):
display: flex;: Uses Flexbox for layout.
justify-content: space-around;: Distributes menu items evenly with equal space around them.
Menu Items (li):
list-style: none;: Removes the default bullet points from list items.
color: white;: Sets the text color to white.
cursor: pointer;: Changes the cursor to a pointer to indicate clickable items.
li:hover: Changes text color to black when hovering over a menu item.
Sub-menu (.subMenu):
display: none;: Initially hides the sub-menu items.
position: absolute;: Positions the sub-menu relative to its parent.
background: rgb(34, 124, 133);: Sets a different background color for sub-menus.
padding: 0;: Removes padding around the sub-menu.
width: 100px;: Sets a fixed width for sub-menus.
Sub-menu Items (.subMenu li):
padding: 10px;: Adds padding to sub-menu items for spacing.
subMenu li:hover: Changes the background and text color of sub-menu items on hover.
Sub-menu Visibility on Hover (li:hover .subMenu):
display: block;: Makes the sub-menu visible when hovering over its parent menu item.
Explanation
The provided code creates a horizontal navigation menu with drop-down sub-menus. The main menu items are displayed across the page using Flexbox, while sub-menus are initially hidden and only shown when the user hovers over a parent menu item. CSS Grid is used to structure the header, while Flexbox is employed for aligning the main menu items horizontally.
By using display: none; and display: block;, the sub-menus are toggled on and off based on user interaction, creating a simple and effective drop-down menu effect. This approach is common for creating clean and responsive navigation menus in web design.
creating a simple navigation menu in html and css
how to build a dropdown menu with sub-menus in html and css
designing responsive menus using css
easy guide to html and css menu design
creating hover-based sub-menus with css
building a horizontal menu with dropdowns in html
css techniques for stylish navigation menus
simple menu design with css flexbox
how to create a vertical menu with sub-menus in html
responsive menu design using css grid
building a mobile-friendly navigation menu in html
advanced css for menu and sub-menu styling
creating an animated menu with css transitions
how to design a multi-level menu in html
designing a sticky navigation menu using css
tips for creating accessible menus with html and css
building a collapsible menu with css and javascript
css tricks for beautiful sub-menu designs
creating a mega menu layout using html and css
building a sidebar menu with nested items in html and css
"html menu, css menu, dropdown menu, sub-menu design, navigation bar, responsive menu, css grid, css flexbox, hover effects, menu styling, css transitions, vertical menu, horizontal menu, multi-level menu, mobile-friendly menu, sticky navigation, accessible menus, collapsible menu, sidebar menu, mega menu."
#menu #design #html #css #submenu
Watch video How to Design simple Menu with Sub-Menu in Html Css || Menu Design Html Css || Html || Css online without registration, duration hours minute second in high quality. This video was added by user Coding Comics 09 August 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 468 once and liked it 1 people.