Home

recent posts

How to create Drop Down option Using html and CSS | Drop down Using html and CSS

Drop down Using html and CSS

Learn How to make a Drop down Using html and CSS . latest page loader aminaton design with HTML and CSS. Web site Design Tutorial

Video Tutorial

font awesome icons link Click Here

How to use the code in stpe by step

  1. Open Your text Editor(like: VS code, SublimeText or Notepad++)
  2. Create a .html(like: index.html) file
  3. Copy the HTML code the code and past in the index.html file
  4. Then, Create a .css(like: style.css) file
  5. Copy the CSS code and past in style.css file
  6. Open the file in your browser

HTML CODE

HTML is a standard language for web page. With HTML you can create your own website. HTML is easy to learn - You will enjoy it


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Drop Down menu</title>

    <link rel="stylesheet" href="style.css">
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
    />
</head>
<body>
    <div class="container">
        <input type="checkbox" name="" id="" class="btn">
        <div class="list">
            <a href="#"><i class="fa fa-user"></i>&nbspProfile</a>
            <a href="#"><i class="fa fa-envelope"></i>&nbspMessage</a>
            <a href="#"><i class="fa fa-cog"></i>&nbspSettings</a>
            <a href="#"><i class="fa fa-sign-out"></i>&nbspLog Out</a>
        </div>
    </div>
</body>
</html>

CSS CODE

The Full from of CSS is Cascading Style Sheets. It explains how to show HTML elemnts on display. For web designers, it is powerfull tool to adjust the design and control of the web pages t demonstrate how they should be viewed.

  
	

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.container{
    width: 200px;
    position: relative;
}

.btn{
    width: 100%;
    height: 35px;
    cursor: pointer;
    position: relative;
}

.btn::before{
    content: 'Drop Down';
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.062);
    border: 2px solid #ffa500;
    padding: 1em;
    background: linear-gradient(to right, #fff 80%, #ffa500 20%);
}

.btn::after{
    content: '\f062';
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Font Awesome 5 free';
    font-weight: 700;
    width: 20%;
    height: 110%;
    color: #fff;
    transform: rotate(180deg);
    transition: all .4s;
    z-index: 99;
}

.btn:checked::after{
    transform: rotate(0deg);
}

.list{
    position: absolute;
    margin-top: 0.5em;
    width: 100%;
    height: 175px;
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    display: flex;
    flex-direction: column;
    transition: all .4s;
}

input:checked ~ .list {
    clip-path: none;
}

.list a{
    height: 25%;
    display: flex;
    align-items: center;
    padding: 0.3em 0 0.3em 1em;
    text-decoration: none;
    margin: 0.3em 0;
    background: #fff;
    color: rgba(36, 36, 36);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.062);
    transition: background .4s;
}

.list a:hover{
    background: #ffa500;
    color: #fff;
}


No comments:

top navigation

Powered by Blogger.