.

How to: float?

by Simon Deshaies 18. March 2008 16:52

In web design, one of my favorite CSS propriety is float. Here I’ll demonstrate how to use it to built a page header. In this simple example I float every section left.

body
{
    padding: 0px;
    font-family: Century Gothic, Tahoma, Sans-Serif;
    font-size: small;
}
.ContentPlaceHolder
{
    /* this is to center the content in the browser page*/
    margin: 0 auto;
    width: 800px;

    border: solid 1px gray;
    height: 100%;
}
.PageHead
{
    width: 800px;
    height: 100px;
}
.PageBody
{
    width: 800px;
    height: 600px;
}
.FloatingLayer
{
    float: left;
    width: 266px;
}
<div class="ContentPlaceHolder">
    <div class="PageHead">
        <div class="FloatingLayer">
            <img src="http://weblog.simondeshaies.com/sample/support.png" alt="Support Logo" /></div>
        <div class="FloatingLayer" style="text-align: center;">
            <h1>
                My Web Site!</h1>
        </div>
        <div class="FloatingLayer" style="text-align: right;">
            <a href="#">My Link</a></div>
    </div>
    <div class="PageBody">
        My Content Here</div>
</div>

Tags: ,

Comments

Powered by BlogEngine.NET
Theme by Mads Kristensen and Simon Deshaies

About the author

Simon Deshaies

Name of authorI do web development, I focus on your business processes by dramatically increasing your visibility. I develop strong Internet and Web applications. My main objective is to support your performance by optimizing your presence on the Web and to advise you on the best web technology to fit your needs.

Linked in profile

Specialties:
.NET development, Internet and Web applications.
HTML, XHTML, XML, XSL, CSS, ASP.NET, AJAX, C#, SQL.
Microsoft Windows Server 2000 to 2008, SQL Server 2000 to 2008, MySQL, IIS, DNS.

BlogRoll

Download OPML file OPML