This article is to share the content of the CSS implementation of the response drop-down menu code, the content is very reference value, I hope to help the need for small partners.
First, Introduction
The Responsive drop-down menu can have different effects on multiple mobile displays.
Second, the code is as follows
<!doctype html>
body{
margin:0;
}
. nav{
Width:100%;background-color: #00316b;p osition:relative;
}
ul{
padding:0px;margin:0px;width:80%;margin:0 Auto;background: #00316b;
}
ul>li{
List-style:none;float:left;
}
ul>li>a{
Color: #fff; text-decoration:none;display:block;padding:20px 30px;
}
ul>li:hover{
background-color:red;
}
. clearfix:after{
Display:block;content: ""; height:0px;visibility:hidden;clear:both;
}
. clearfix{
Zoom:1;
}
. toggle{
Text-align:right;color: #fff;p adding:20px;font-size:20px;background:black;/* background-color: #001r44; */display:none;overflow:hidden;
}
. tu{
Float:left;
}
. bb{
Position:absolute;background-image:url (shitu2.png); background-repeat:no-repeat;background-size:100px;width : 100px;height:40px;left:20px;top:10px;
}
----------body{ margin:0;}. nav{ width:100%; Background-color: #00316b;} ul{ padding:0px; margin:0px; width:100%; margin:0 Auto; Background: #00316b;} ul>li{ Text-align:center; List-style:none; /* FLOAT:LEFT; */}ul>li>a{ color: #fff; Text-decoration:none; Display:block; padding:20px 30px;} ul>li:hover{ background-color:red;}. clearfix:after{ Display:block; Content: ""; height:0px; Visibility:hidden; Clear:both;}. clearfix{ zoom:1;}. toggle{ text-align:right; Color: #fff; padding:20px; Background:yellow; font-size:20px; Overflow:hidden; Display:block;}. tu{ Float:left; width:100px;}
Third, the following
This is the content displayed when the viewport is larger than 1024px <pc end >
Min-width:1024px
This is the content displayed when the viewport is less than 1024px < phone >
Max-width:1024px
It's on the phone and on the ipad.
Related recommendations:
How CSS and JS implement responsive navigation menus
CSS How to customize scroll bars (code)