CSS Grade Menu
Category: NavigationThe grade menu is a simplified version of the Menu module. Unlike typical components or modules, grade is built with native CSS+HTML, allowing users to insert custom content while preserving its core structure, and can be integrated into custom modules or components.
Introduction
For implementing an unlimited-level menu without fancy effects using pure CSS, this framework's grade
menu is designed with these key points:
- Uses
ul+li
to build hierarchical relationships - Uses
hover
pseudo-class for mouse interaction to show/hide
Users can encapsulate the menu into other modules or plugins. The framework already includes powerful menu modules like Menu, Navigation and Dropdown.
Basic Usage
Since the grade menu is built with pure CSS, it has specific format requirements:
- Place root menu name in
_grade
node - Use
rep=host
node for host container (optional) - Build hierarchy with
ul+li
- Add
_grade-wrap
class to root ul, with at leastrep=head
andrep=label
tags in submenus - Use
_reset
class to clear default ul+li styles
- Output
- HTML
States
Submenus have three states: normal
, selected
, and disabled
. Add selected
or disabled
attributes to rep=head
node.
- Output
- HTML
Host Node
If a host node is marked with rep=host
, any internal node with rep=arrow
will display an indicator animation when the menu expands or collapses.
Adding the selected
attribute to the host node will show an indicator light effect; the indicator always appears directly below the host node at the very bottom.
In the selected
state, if you want to use the host menu's indicator light effect, you need to include a rep=label
tag.
- Output
- HTML
-
Use arrowUse lamp
-
Using Icon Indicators
rep=icon
represents a font icon.
- Output
- HTML
-
Grade Menu
-
Using Indicator Images
Supports three types of indicator images:
rep=disk
: Circular imagerep=cube
: Square imagerep=image
: Regular image
- Output
- HTML
-
Grade Menu
-
Multi-line Content
Submenu content is not limited to a single line - it can display two or more lines. For multi-line text truncation, use the _ell-*
style class, where *
can be a value from 1
to 9
. _ell
indicates single-line truncation.
For detailed usage of truncation styles, click here.
- Output
- HTML
-
Grade Menu
-
Center Alignment
Menu content is left-aligned by default. For more uniform content layouts, center alignment can be used by applying the _a-c
style class to the root node (where a=align, c=center).
For detailed usage of text alignment styles, click here.
- Output
- HTML
Positioning
Default position is bottom
. Other options:
- placement=bottom-start: Bottom right
- placement=bottom-end: Bottom left
- placement=right: Right side
- Output
- HTML
-
bottom-startbottombottom-endright
-
Dropdown Panel
For custom menus, replace ul+li with div tags in _grade-wrap
. Supports placement
attribute.
- Output
- HTML
-
bottom-startGermany plays a central role in the European Union and is known for its precision engineering, strong industrial base, and political stability.bottomGermany plays a central role in the European Union and is known for its precision engineering, strong industrial base, and political stability.bottom-endGermany plays a central role in the European Union and is known for its precision engineering, strong industrial base, and political stability.rightGermany plays a central role in the European Union and is known for its precision engineering, strong industrial base, and political stability.
-
Menu Group
Wrap multiple _grade
nodes in _group-grade
container to create a menu group.
- Output
- HTML
Always Expanded
For better mobile experience (since hover doesn't work well), add expanded
attribute to root node to keep menu always open. Expanded menus show hierarchy with indentation.
- Output
- HTML
-
Grade Menu
About Germany Germany plays a central role in the European Union and is known for its precision engineering, strong industrial base, and political stability. The country has a rich history that spans from classical music and philosophy to major 20th-century events. Today, Germany is a champion of green energy, automotive excellence, and global diplomacy. Cities like Berlin and Munich combine historical depth with modern innovation. -