How to Make Header in Html and CSS (Best Header Design)

In This, Article You will Learn How to Make Header in HTML and CSS or Create Header in  HTML CSS .  Whenever you start designing a website. So first we have to do Header Design. Designing the header is a bit hard. Because it has to design logo and many links. Then it has to be made responsive. But in this article, complete information about How to Make Header in Html and CSS or How Design Responsive Header is given. Here, not only the code but how it is designed. It is also explained.



How to Make Header in HTML CSS 

First We will Share The Code of Header Design and then we explained you. This is a Simple Header Only you can see and learn how make header in HTML CSS

Simple Header Design 


This is Very Simple Header Design Which has logo image in Left Side and Navigation Links in Right Side. It is Responsive and  Its code is very simple and clean, which can be easily understood. 


You can check Responsive design by reducing the width of the Browser.

HTML Code 


<!DOCTYPE html>
<html>
<head>
	<title>Header Design</title>
	<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>

<div class="Header">
<div class="logo">
<img src="https://1.bp.blogspot.com/-4m_nJYxnWWQ/X8ndVPH8l8I/
AAAAAAAABO8/fQj64VedI6Qkh2l5D-sQ2VLeXyShwCKsgCLcBGAsYHQ/w400-h88/
cooltext370479803482355.png">	
</div>	
<div class="menu">
<ul class="menu-link">
	<li> <a href=""> Home</a> </li>
	<li> <a href=""> About Us</a> </li>
	<li> <a href=""> Contact Us</a> </li>
	<li> <a href=""> Privacy Policy</a> </li>
</ul>	
</div>
</div>

</body>
</html>

Now can see its HTML code. Let's try to understand it.

1. First Need a div for start making header. <div class="Header" Its class header is taken.

2. Now a second div has been created which will determine the left side <div class="logo"which has been added logo with img tag. 

3. Now the source of logo img has to be given in it. 

4. Similarly, now we have to create a Div for a Right Side. In which we will add a link to the navigation menu. <div class="menu">

5. Now the link has been added. This has been added through the ul li tag.

Similarly, HTML Coding of Our Header Design is Completed. Now we start moving towards CSS. 

CSS Code 


body {
	margin: 0;
	padding: 0;
}

.Header {
overflow: hidden;
	width: 100%;
    background-color: #a94e52;
    box-shadow: 0 0 25px 0 rgba(0,0,0,.12);
}

.logo {
	float: left;
}
.logo img{
	line-height: 1px;
}
.menu {

	
	padding-right: 25px;
}
ul {
	list-style-type: none;
	float: right;
}
li {
	padding: 10px;
	float: left;
}
li a {

	font-size: 25px;
	text-decoration: none;
	color: #ffed13;
    font-weight: bold;
}
@media screen and (max-width: 900px) {
   .logo {
      width: 20%
   }
   li a {

	font-size: 15px;
    line-height: 2;
}
}

Now the design of this Header is complete.

Full Code of Header Design 


<!DOCTYPE html>
<html>
<head>
	<title>Header Design</title>
	
<style>
body {
	margin: 0;
	padding: 0;
}

.Header {
overflow: hidden;
	width: 100%;
    background-color: #a94e52;
    box-shadow: 0 0 25px 0 rgba(0,0,0,.12);
}

.logo {
	float: left;
}
.logo img{
	line-height: 1px;
}
.menu {

	
	padding-right: 25px;
}
ul {
	list-style-type: none;
	float: right;
}
li {
	padding: 10px;
	float: left;
}
li a {

	font-size: 25px;
	text-decoration: none;
	color: #ffed13;
    font-weight: bold;
}
@media screen and (max-width: 900px) {
   .logo {
      width: 20%
   }
   li a {

	font-size: 15px;
    line-height: 2;
}
}
</style>

</head>
<body>

<div class="Header">
<div class="logo">
<img src="https://1.bp.blogspot.com/-4m_nJYxnWWQ/X8ndVPH8l8I/AAAAAAAABO8/
fQj64VedI6Qkh2l5D-sQ2VLeXyShwCKsgCLcBGAsYHQ/w400-h88/cooltext370479803482355.png">	
</div>	
<div class="menu">
<ul class="menu-link">
	<li> <a href=""> Home</a> </li>
	<li> <a href=""> About Us</a> </li>
	<li> <a href=""> Contact Us</a> </li>
	<li> <a href=""> Privacy Policy</a> </li>
</ul>	
</div>
</div>

</body>
</html>

Create a Fixed  Header On Scroll

Many Beautiful Modern Websites have fixed header. When, We do Scroll Down. The header of this type is included in high quality websites. Now, We will Create Fixed Header. 



HTML Code 



<!DOCTYPE html>
<html>
<head>
	<title>Header Design</title>
	<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>

<div class="Header" id="MyHeader">
<div class="logo">
<img src="https://1.bp.blogspot.com/-4m_nJYxnWWQ/X8ndVPH8l8I/AAAAAAAABO8/
fQj64VedI6Qkh2l5D-sQ2VLeXyShwCKsgCLcBGAsYHQ/w400-h88/cooltext370479803482355.png">	
</div>	
<div class="menu">
<ul class="menu-link">
	<li> <a href=""> Home</a> </li>
	<li> <a href=""> About Us</a> </li>
	<li> <a href=""> Contact Us</a> </li>
	<li> <a href=""> Privacy Policy</a> </li>
</ul>	
</div>
</div>
<div class="main-section">
	<img src="https://1.bp.blogspot.com/-R_jVh-Ee7Fs/X_KuIE3ssDI/AAAAAAAAABk/
AUfM-bRDRQ8jQlq6wXzdPiPKGG0RNV9aACLcBGAsYHQ/s320/office-730681%2B%25282%2529.jpg">
	
</div>
<div class="box">
	<div class="box-details">
		<p> We Provide Free Template and Web design details. Anyone Can
                  learn free
                     web development With me.</p>
 
	</div>
	
</div>
<script type="text/javascript">
	
window.onscroll = function() {myFunction()};

var header = document.getElementById("MyHeader");
var sticky = header.offsetTop;

function myFunction() {
  if (window.pageYOffset > sticky) {
    header.classList.add("sticky");
  } else {
    header.classList.remove("sticky");
  }
}
</script>
</body>
</html>


CSS Code 

<style>
body {
	margin: 0;
	padding: 0;
}

.Header {
overflow: hidden;
	width: 100%;
    background-color: #a94e52;
    box-shadow: 0 0 25px 0 rgba(0,0,0,.12);
}

.logo {
	float: left;
}
.logo img{
	line-height: 1px;
}
.menu {

	
	padding-right: 25px;
}
ul {
	list-style-type: none;
	float: right;
}
li {
	padding: 10px;
	float: left;
}
li a {

	font-size: 25px;
	text-decoration: none;
	color: #ffed13;
    font-weight: bold;
}
@media screen and (max-width: 900px) {
   .logo {
      width: 20%
   }
   li a {

	font-size: 15px;
    line-height: 2;
}
}
.sticky {
  position: fixed;
  top: 0;
  width: 100%;
}


.main-section img {

	width: 100%;
    height: 70vh;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    align-items: center;
    margin: 0;
    padding: 0;
}

.box-details p {

	text-align: center;
	padding-bottom: 500px;
}
</style>

 Now we have created HTML CSS and Javascript Code for Fixed header. Embed all three into one and try running.

Full Code of Fixed Header Design



<!DOCTYPE html>
<html>
<head>
	<title>Header Design</title>
	<style>
body {
	margin: 0;
	padding: 0;
}

.Header {
overflow: hidden;
	width: 100%;
    background-color: #a94e52;
    box-shadow: 0 0 25px 0 rgba(0,0,0,.12);
}

.logo {
	float: left;
}
.logo img{
	line-height: 1px;
}
.menu {

	
	padding-right: 25px;
}
ul {
	list-style-type: none;
	float: right;
}
li {
	padding: 10px;
	float: left;
}
li a {

	font-size: 25px;
	text-decoration: none;
	color: #ffed13;
    font-weight: bold;
}
@media screen and (max-width: 900px) {
   .logo {
      width: 20%
   }
   li a {

	font-size: 15px;
    line-height: 2;
}
}
.sticky {
  position: fixed;
  top: 0;
  width: 100%;
}


.main-section img {

	width: 100%;
    height: 70vh;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    align-items: center;
    margin: 0;
    padding: 0;
}

.box-details p {

	text-align: center;
	padding-bottom: 500px;
}
</style>
</head>
<body>

<div class="Header" id="MyHeader">
<div class="logo">
<img src="https://1.bp.blogspot.com/-4m_nJYxnWWQ/X8ndVPH8l8I/AAAAAAAABO8/
fQj64VedI6Qkh2l5D-sQ2VLeXyShwCKsgCLcBGAsYHQ/w400-h88/cooltext370479803482355.png">	
</div>	
<div class="menu">
<ul class="menu-link">
	<li> <a href=""> Home</a> </li>
	<li> <a href=""> About Us</a> </li>
	<li> <a href=""> Contact Us</a> </li>
	<li> <a href=""> Privacy Policy</a> </li>
</ul>	
</div>
</div>
<div class="main-section">
	<img src="https://1.bp.blogspot.com/-R_jVh-Ee7Fs/X_KuIE3ssDI/AAAAAAAAABk/
AUfM-bRDRQ8jQlq6wXzdPiPKGG0RNV9aACLcBGAsYHQ/s320/office-730681%2B%25282%2529.jpg">
	
</div>
<div class="box">
	<div class="box-details">
		<p> We Provide Free Template and Web design details. Anyone Can
                  learn free
                     web development With me.</p>
 
	</div>
	
</div>
<script type="text/javascript">
	
window.onscroll = function() {myFunction()};

var header = document.getElementById("MyHeader");
var sticky = header.offsetTop;

function myFunction() {
  if (window.pageYOffset > sticky) {
    header.classList.add("sticky");
  } else {
    header.classList.remove("sticky");
  }
}
</script>
</body>
</html>

1 comment:

  1. No deposit free spins no deposit casinos
    No Deposit Bonuses by Casino Software 한게임바카라 — No deposit free spins 시스템 배팅 no deposit casinos 스코어 사이트 allow players 토토 라이브 스코어 to play their favorite games at a casino without having to 7포커 make a deposit. However, if

    ReplyDelete