CSS填充不起作用

时间:2014-05-15 20:53:51

标签: html css

我的Padding不起作用。我正在使用php和css。以下是与之关联的四个文件。 Header.php,footer.php,index.php,stylesheet.css。我试过添加

    Display: block;

Picture of exported code

的index.php:

    <?php include ('header.php') ?>
    <html>
        <head>
            <title>Armenian Genocide</title>
            <link rel="stylesheet" type="text/css" href="stylesheet.css">
        <body>
            <div id='content'>
            </div>
        </body>
    </html>
    <?php include ('footer.php') ?>

的header.php:

    <html>
        <head>
            <title>
                    Armenian Genocide
            </title>
        </head>
        <body>
            <div id='head'>
                <h1>HEADER</h1>
            </div>
        </body>
    </html>

Footer.php:

<html>
        <head>
            <title>
                    Armenian Genocide
            </title>
        </head>
        <body>
            <div id='footer'>
                <h1>FOOTER</h1>
            </div>
        </body>
    </html>

stylesheet.css中:

    body{
        background-image: url('images/background.jpg');
    }

    #head{
        width: 1380px;
        height: 100px;
        background-color: #FF0000;
        display: block;
        padding-left:25px;
        padding-right:25px;
        padding-top:25px;
        padding-bottom: 25px;
    }

    #content{
        width: 1380px;
        height: 800px;
        background-color: #5C8A8A;
        display: block;
        padding-left: 25px;
        padding-right: 25px;
    }

    #footer{
        width: 1380px;
        height: 100px;
        background-color: #253737;
        display: inline-block;
        padding-left: 25px;
        padding-top: 25px;
        padding-right: 25px;
    }

1 个答案:

答案 0 :(得分:1)

它可能不起作用,因为你有多个head,html和body。

应该是:

的index.php

<html>
    <head>
        <title>Armenian Genocide</title>
        <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <body>
        <?php include ('header.php') ?>
        <div id='content'>
        </div>
<?php include ('footer.php') ?>
    </body>
</html>

header.php

<div id='head'>
            <h1>HEADER</h1>
        </div>

footer.php

<div id='footer'>
            <h1>FOOTER</h1>
        </div>