hello student here we will see that how to make side war using html and css i hope that you will like of this tutorial and if you want amazing source code so dont forget to supporting us through subscribe and share of this bog website among your friends for next topic
lets break of this topic
1. Here you can create a header part and set of this on top through position absolute
#menu {
background-color: darkred;
color: white;
position: absolute;
top: 0px;
line-height: 40px;
height: 40px;
width: 100%;
padding-left: 10px;
text-transform: uppercase;
}
in this header part we will take any tag where we will use a javascript function onclick and you can choose any name of this function i choosed open because we want to open of this head
2. and next topic is here we will take a div or nav tag for storing
<li> tag .
you can take any href link under <li> tag. we did not take any link in this li tag because
it is a sample. in css of this nav. we will css of this nav tag like this .
#head {
padding-top: 40px;
background-color: black;
height: 100%;
width: 0%;
color: white;
position: fixed;
top: 0px;
z-index: 1;
overflow-x: hidden; /* don t forget of this*/
left: 0px;
transition: width 1s ease-in-out;
}
3. we set of this
you can use of this source code through copy and paste .
according to video . background image will not show in your pc because it is not save in your pc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
body {
background-image: url("domenico-loia-hGV2TfOh0ns-unsplash.jpg");
/* here you can set any other background in from your pc*/
height: 100vh;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
#head {
padding-top: 40px;
background-color: black;
height: 100%;
width: 0%;
color: white;
position: fixed;
top: 0px;
z-index: 1;
overflow-x: hidden;
left: 0px;
transition: width 1s ease-in-out;
}
ul li {
line-height: 40px;
height: 40px;
text-align: center;
text-transform: capitalize;
}
.close {
cursor: pointer;
position: absolute;
top: 5px;
right: 5px;
font-size: 20px;
color: white;
font-weight: bolder;
}
ul li:hover {
color: green;
}
.youtube {
position: absolute;
top: 5px;
left: 5px;
}
#menu {
background-color: darkred;
color: white;
position: absolute;
top: 0px;
line-height: 40px;
height: 40px;
width: 100%;
padding-left: 10px;
text-transform: uppercase;
}
</style>
</head>
<body>
<header id="head">
<a class="youtube">Easy coding.7</a>
<!-- here &time is code of icon -->
<a class="close" onclick="myClose()">×</a>
<nav>
<ul>
<li>home</li>
<li>about</li>
<li>products</li>
<li>pricing</li>
<li>subscribe</li>
</ul>
</nav>
</header>
<a id="menu" onclick="onOpen()">menu</a>
<script>
function onOpen() {
document.getElementById('head').style.width = "40%";
}
function myClose() {
document.getElementById('head').style.width = "0px";
}
</script>
</body>
</html>
Comments
Post a Comment