http://www.pixelpusher.biz/

Free articles for submit about web design. All about internet business, Web Design, SEO, Spam, Traffic Generation, Site Promotion, Domains, Auctions - How to earn money in the Internet

RSS

Navigation

Top articles

.

pixelpusher.biz » CSS & Design » Fixed height headers

Fixed height headers

Date3-11-2010, 19:34 CategoryCategory: CSS & Design ViewsViews: 2206
This article is a simple "how to" about developing headers with fixed height. You'll agree that most of them fall into this category.

Introduction

This is basically the description of my process when dealing with headers. It allows you to not only to be precise in positioning header elements, but also to manipulate with markup in a way that you prefer, or in a way that web standards imply.

The markup

Most common elements in header are logo, slogan and main navigation. We also might add a search box. You can put any element you need. The principle is always the same.
Let’s presume that we already have centered container div with fixed width. We’ll create a header div and put all of our elements inside. As mentioned, we have logo, slogan, main navigation and search form. We’ll use headings for logo and slogan, unordered list for navigation and form element.

Styling

Main idea of this approach to creating headers is absolute positioning of header elements. Once you have header div placed and you know its width and height you can treat it as coordinate system. Every element inside the header will have top and left values that will place him on exact location within that system. If your elements are overlapping you can add z component (z-index) and have 3D coordinate system.
Important thing is that when describing header div you must add position: relative so the elements inside it can refer to it.
Note: I will not go into detailed styling of each element. The purpose of this article is to show you the principles so you can use this idea with your css.


#header{
    height:150px;
    position:relative;
}
/*  each element is positioned absolute
and it contains values for top and left */
h1{
    position:absolute;
    top:50px;
    left:50px;    
    font-size:140%;
}
h2{
    position:absolute;
    top:80px;
    left:50px;    
    font-size:110%;
}
/* menu bar in full width */
#header ul{
    position:absolute;
    top:120px;
    left:0;
    width:100%;
    text-align:center;
    background:#000;
}
#header li{
    display:inline;
    line-height:30px;
    list-style:none;
    padding:0 1em;
}
#header a{
    color:#fff;    
    text-decoration:none;
}
/* form element */
#header form{
    position:absolute;
    top:10px;
    right:10px;
/* for elements that should be placed on the right
you can use right value instead of left */

}

Read about Fixed height headers, Article about Fixed height headers, Free Submit Article about internet business, Web Design, SEO, Free Submit Fixed height headers

Tags

Friends

Best article directory - cyclingadvocacy.com, only fresh, unique, original articles for submit.
 
Êíîïêà 88*31 èëè ñ÷åò÷èê 88*31