


CSS: Collapse menu under responsive style (striped style)_html/css_WEB-ITnose
Original text: CSS: Responsive Navigation Menu
Translation: CSS: Responsive Navigation Menu
Translator: dwqs
Written before, about how to make a responsive drop-down menu: Responsive drop-down menu
Previously, I wrote a tutorial on how to make responsive mobile navigation. Now, I've discovered a new trick to implement responsive menus without using JavaScript, but using HTML 5's clear semantic markup.
This menu can be aligned left, center and right, unlike the menu mentioned in the previous article that requires clicking to switch between showing and hiding. It also has a marker showing the active/current menu item, and it works on all mobile platforms and all desktop browsers including IE.
First, take a look at the effect of the Demo: Demo
1. Purpose
The purpose of this tutorial is to show how to turn a regular list menu into A smaller display dropdown menu.
This trick is very useful on navigations composed of many links, such as the screenshot below, to condense all the buttons into an elegant drop-down.
2. Nav HTML tags
<nav class="nav"> <ul> <li class="current"><a href="#">Portfolio</a></li> <li><a href="#">Illustration</a></li> <li><a href="#">Web Design</a></li> <li><a href="#">Print Media</a></li> <li><a href="#">Graphic Design</a></li> </ul></nav>
3. CSS
/* nav */.nav { position: relative; margin: 20px 0;}.nav ul { margin: 0; padding: 0;}.nav li { margin: 0 5px 10px 0; padding: 0; list-style: none; display: inline-block;}.nav a { padding: 3px 12px; text-decoration: none; color: #999; line-height: 100%;}.nav a:hover { color: #000;}.nav .current a { background: #999; color: #fff; border-radius: 5px;}
4. Center and right alignment
As mentioned earlier, it can be changed through the text-align attribute Alignment.
/* right nav */.nav.right ul { text-align: right;}/* center nav */.nav.center ul { text-align: center;}
5. IE support
In IE 8 and earlier versions, HTML5 nav tags and media are not supported. Query. Introduce css3-mediaqueries.js (or respond.js) and html5shim.js to provide fallback compatibility processing. If you don’t want to use html5shim.js, you can use div instead of nav

HTML is not only the skeleton of web pages, but is more widely used in many fields: 1. In web page development, HTML defines the page structure and combines CSS and JavaScript to achieve rich interfaces. 2. In mobile application development, HTML5 supports offline storage and geolocation functions. 3. In emails and newsletters, HTML improves the format and multimedia effects of emails. 4. In game development, HTML5's Canvas API is used to create 2D and 3D games.

TheroottaginanHTMLdocumentis.Itservesasthetop-levelelementthatencapsulatesallothercontent,ensuringproperdocumentstructureandbrowserparsing.

The article explains that HTML tags are syntax markers used to define elements, while elements are complete units including tags and content. They work together to structure webpages.Character count: 159

The article discusses the roles of <head> and <body> tags in HTML, their impact on user experience, and SEO implications. Proper structuring enhances website functionality and search engine optimization.

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.

Article discusses specifying character encoding in HTML, focusing on UTF-8. Main issue: ensuring correct display of text, preventing garbled characters, and enhancing SEO and accessibility.

The article discusses various HTML formatting tags used for structuring and styling web content, emphasizing their effects on text appearance and the importance of semantic tags for accessibility and SEO.

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
