adc

clicks

How To Make Drop Down Menu Using HTML And CSS

 This wikiHow teaches you how to create a drop-down menu for your website by using HTML and CSS coding. The drop-down menu will appear when someone hovers over its button; once the drop-down menu appears, the user will be able to click one of the options in it to visit the option's webpage

 

 

 HTML

Before we start writing code first, we need to create a primary structure of the HTML document, so that the browser can understand and start working. The basic HTML structure looks like the following.

After writing the primary structure of the HTML document, you will also write the tags and content you need. After that, you can see the output in your browser. We know that HTML Sudu Mae is used for exposing content in a basic format. To complete our content we need to use CSS, which is an HTML insert and it creates an engaging user interface.

 <!DOCTYPE html>
<html>
<head>
    <title>Dropdwon menu</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="wrapper">
        <ul>
            <li>Home</li>
            <li>about</li>
            <li>Service
                <ul>
                    <li>Marketing</li>
                    <li>Design
                        <ul>
                            <li>Web</li>
                            <li>Graphic</li>
                            <li>ui</li>
                        </ul>

                    </li>
                    <li>Brading</li>
                </ul>
            </li>
            <li>Portfolio</li>
            <li>Contact</li>
        </ul>
    </div>

</body>
</html>

CSS

Now, we have time to improve the HTML content, for that, we need to add CSS to the HTML file. CSS can be added to HTML documents in a total of three ways, here we are using outside CSS design using CSS will arrive here after typing and see the output in your browser.

 *{
    margin: 0;
    padding: 0;
}
body{
    background-image: url(image.jpg);
    -webkit-background-size:cover;
    background-size: cover;
    background-position: center center;
    height: 100vh;
}

.wrapper{
    width: 860px;
    margin: 0 auto;
}
.wrapper ul{
    list-style: none;
    margin-top: 2%;
}
.wrapper ul li{
    background: #262626;
    width: 170px;
    border:1px solid #fff;
    height: 50px;
    line-height: 50px;
    text-align: center;
    float: left;
    color: #fff;
    font-size: 14px;
    position: relative;
    font-family: sans-serif;
}
.wrapper ul li:hover{
    background: crimson;
}
.wrapper ul ul{
    display: none;
}
.wrapper ul li:hover>ul{
    display: block;
}

.wrapper ul ul ul{
    margin-left: 170px;
    top: 0;
    position: absolute;
}

 

 Source Code

 


Watch Video 

 

 More Tutorials

 

How To Make Drop Down Menu Using HTML And CSS How To Make Drop Down Menu Using HTML And CSS Reviewed by easycoding on August 17, 2020 Rating: 5

No comments:

Powered by Blogger.