開発メモ

開発用のメモです。

ヘッダー、フッターをCSSで固定する。

html / php

<!DOCTYPE html>
<html>
<head>
   <?php echo $this->Html->charset(); ?>
   <title><?php echo __d("users", $this->action) ?> | <?php echo __d("users", $this->name) ?></title>
   <?php
    echo $this->Html->meta ( 'icon' );
    echo $this->Html->css ( 'Users.main' );
    echo $this->fetch ( 'meta' );
    echo $this->fetch ( 'css' );
    echo $this->fetch ( 'script' );
    ?>
</head>
<body>
    <div id="container">
        <div id="header">
            <h1><?php echo __d("users", $this->name) ?></h1>
        </div>
        <div id="content">

            <?php echo $this->Session->flash(); ?>

            <?php echo $this->fetch('content'); ?>
                    </div>
        <div id="footer">footer contents</div>
    </div>
</body>
</html>

CSS

* {
    padding: 0;
    margin: 0;
}

html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    height: 100%;
    font-size: 18px;
    background-color: #CCC;
}

#container {
    width: 80%;
    height: 100%;
    min-height: 100%;
    margin: 0 auto;
    background-color: #FFF;
    min-width: 550px;
}

body>#container {
    height: auto;
    position: relative;
}

#header {
    margin: auto;
    width: 100%;
    height: 60px;
    position: absolute;
    top: 0px;
    background-color: rgb(164, 64, 64);
}

#footer {
    margin: auto;
    width: 100%;
    height: 60px;
    position: absolute;
    bottom: 0px;
    background-color: rgb(164, 64, 64);
}

#content {
    padding: 60px 0;
}
Twitter: @asahina_alice