abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

12/14/2020

How to create Responsive header for Mobile webpages

 Responsive means which is works on all devices, it is mobile friendly. and it's also good SEO & user interface.


<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {box-sizing: border-box;}


body { 

  margin: 0;

  font-family: Arial, Helvetica, sans-serif;

}


.header {

  overflow: hidden;

  background-color: #f1f1f1;

  padding: 20px 10px;

}


.header a {

  float: left;

  color: black;

  text-align: center;

  padding: 12px;

  text-decoration: none;

  font-size: 18px; 

  line-height: 25px;

  border-radius: 4px;

}

 


.header a:hover {

  background-color: #ddd;

  color: black;

}


.header a.active {

  background-color: dodgerblue;

  color: white;

}


.header-right {

  float: right;

}


@media screen and (max-width: 500px) {

  .header a {

    float: none;

    display: block;

    text-align: left;

  }

  

  .header-right {

    float: none;

  }

}

</style>

</head>

<body>


<div class="header">

  <a href="#default" class="logo"><img src="logo.png"/></a>

  <div class="header-right">

    <a class="active" href="#home">Home</a>

    <a href="#contact">Contact</a>

    <a href="#about">About</a>

  </div>

</div>


<div style="padding-left:20px">

  <h5>Responsive Header</h5>

  <p>Some sample content..</p>

</div>


</body>

</html>


check above code on mobile which shows different view of header , which is easy to user access.


An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...