How to create sticky header using css | Sanwebcorner

How to create sticky header using css

This article helps you to create sticky header using css and php. Now a days sticky headers are very useful and most of the people are using their websites. Because this is user friendly navigation, user easy handle the navigation when user scroll the page also.

This will be easy to create using css and html. the below diagram shows how the fixed or sticky navigation or header looks. Here i am not provide any responsive menu or any responsive layout. This post shows how to create fixed the header in webpages.



css for fixed header :


body
{

background-color: rgba(103, 58, 183, 0.08);
}
.fixed-header {
background-color: #673AB7;
width:100%;
position: fixed;
top: 0;
left: 0;
margin: 0;
padding: 10px;
text-align:left;
color: #fff;
}

.fixed-header a
{
letter-spacing:3px;
color: #fff;
font-weight:bold;
text-decoration:none;

}
.content{
height:1000px;
padding:60px 0px 0px 50px;
}
.content p{
height:150px;
}


Html code for Sticky(fixed) header:


<div class="fixed-header"><a href="">Home</a> &nbsp;|&nbsp; <a href="">About</a> &nbsp;|&nbsp;<a href="">About1</a> &nbsp;|&nbsp;<a href="">About3</a> &nbsp;|&nbsp;  <a href="">Service</a> &nbsp;|&nbsp; <a href="">Service2</a> &nbsp;|&nbsp;  <a href="">Gallery</a> &nbsp;|&nbsp;<a href="">Contact</a> </div>
<div class="content">
<p>sample text1 for  fixed header</p>
<p>sample text1 for  fixed header</p>
<p>sample text1 for  fixed header</p>
<p>sample text1 for  fixed header</p>
<p>sample text1 for  fixed header</p>
</div>

Post a Comment

Labels

360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll create random number Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient hide menu Horizontal News ticker Hover Htm Html html dropdown html form html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript Jquery js Layered image effect on mouse hover lock & unlock page scroll marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form multi-select-checkbox Multi-Step-form Multiple File Upload in PHP mysql News ticker on hover change text to image our team page password generator password strength checker Photoshop PHP php mailer populate html selectbox Popup image on click the link pure css Question type form random number generate Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image selectbox based on select box simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips whatsapp link website Youtube