CSS implementation response drop-down menu code

Source: Internet
Author: User
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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.