How to: float? | Simon Deshaies

by Simon Deshaies 3/18/2008 10:52:00 PM

In web design one of my favorite CSS propriety if the float. Here I’ll demonstrate how to use it to built a page header. In this simple example I float every section left, but it can be done differently.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>My Header</title>
    <style type="text/css">
        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;
        }
    </style>
</head>
<body>
    <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>
</body>
</html>

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

How to:

Related posts

Add comment


 

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

1/7/2009 9:11:05 AM

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

www.aubergedeslegendes.com

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, CSS, ASP.NET, AJAX, C#, SQL.
Microsoft Windows Server 2000 to 2008, SQL Server, MySQL, IIS, DNS.


E-mail me Send mail

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Pages

    Recent comments

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2009

    Sign in