【问题标题】:How to divide footer and header included in php?如何划分php中包含的页脚和页眉?
【发布时间】:2014-12-09 18:10:28
【问题描述】:

我正在使用包含在 php 文档中的页脚,但它正在遍历 php 页面内容。

这里是一个例子:http://screencast.com/t/L69p1gm2

这是我正在使用的代码:

<?php include 'header.php' ?>
<div class="kalendar">
  <iframe class="kalendarframe" src="link to the calendar"&amp;color=%23711616&amp;ctz=Europe%2FBelgrade" style=" border:solid 1px #777 " width="100%" frameborder="0" scrolling="no"></iframe>
</div>
<?php include 'footer.php' ?>

我尝试用 css 做一些事情,但没有任何积极的结果..

这里可能有什么问题?

为什么页脚会越过页面?

谢谢

这是footer.php(为空):

<div id="footer">
</div>
</body>
</html>

这是我的css:

html, body{
            background-color: #fff;
            background-repeat:no-repeat;
            background-attachment:fixed;
            background-size:cover;
            width:100%;
            margin:0px 0px 0px 0px;
            padding:0px;
            position:absolute;
        }


        /* KOMPLETAN HEADER SA MENIJIMA */

        header{
            padding-top:0px;
            text-align:;
            height:40px;
            margin-top:0px;
            margin-left:-10px;
            width:101%;
            position:absolute;
            top:0;
            left:0;
            background-color:#424242;
            opacity:0.9;
            position:fixed;
            font-family: tahoma;
        }


        header .logout a{
            margin-top: 0px;
            padding-right:150px;
            color:white;
            text-transform:uppercase;
            font-size: 14px;
            float:right;
            text-decoration:none;
            font-family: 'Raleway', sans-serif;
        }

        /*  --------------------------  MENI -----------------------*/

        #menu{
            width:960px;
            color:#fff;
            font-size:12px;
            text-transform:uppercase;
            margin: 0 auto;

        }

        #menu ul li {
            display: inline; 
        }

        #menu li a{
            font-family: 'Raleway', sans-serif;
            margin-right: 15px;
            color:#fff;
            text-transform:uppercase;
            font-size: 14px;
            text-decoration:none;

        }

        #menu li a:hover{
            color: red;
            text-decoration:none;
            text-align: center;

        }

        /* -----------------------------------------------------------*/

        /* WRAPPER  SADRZAJ STRANICE */

        #wrapper{
            width:960px;
            margin:0 auto;

        }


        #heading{
            text-align:center;
        }

        #lijevi{
            width: 635px;
            float:left;


        }

        #desni{
            width:310px;
            float:right;
        }

        #mediaContacts{
            float:left;
        }

        #smmSchedule{
            float:right;
        }

        #calls{
            float:left;
        }

        /*iframe{
            border-radius: 15px;
            aborder: 1px solid black;
            -webkit-box-shadow: 2px 7px 81px -5px rgba(0,0,0,0.75);
            -moz-box-shadow: 2px 7px 81px -5px rgba(0,0,0,0.75);
            box-shadow: 2px 7px 81px -5px rgba(0,0,0,0.75);
        }*/

        #table_button{
            /*width:150px;
            height:40px;
            margin:0 auto;
            opacity:0.9;*/

        }

        /* ----------------  FOOTER --------------*/
         #footer{
            margin-top:0px;
            margin-left:-10px;
            height:200px;
            width:101%;
            background-color: #000;
            opacity:0.8;
        }

        /*---------------- RESPONSIVE DESIGN STYLING ------------------------*/

        @media only screen and (min-width: 310px) and (max-width: 960px) {
         body {

         }

         #wrapper{
            width:310px;
            height:1600px;
         }

         #heading{
            margin:0 auto;
         }

         #lijevi{
            width:310px;


         }

         #desni{
            width:310px;
            margin-left:0px;
            float:none;
         }
        }
        /* ---------------------------------------------------------------------*/

        /* KALENDAR STYLING */

        .kalendarframe{
            height:1000px;
            padding-top:80px;

            /*margin-bottom:0px;*/
        }

        .kalendar{
            width:100%;
            height:1000px;
        }


        /* ---------------------*/

【问题讨论】:

  • 生成的html代码不正确:&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&lt;/div&gt; -> 检查最后一个div
  • 我已经理解你并删除了包含'footer.php'周围的div,但没有再次出现......无论有没有它们我都有相同的结果......
  • 请在包含footer.php之前再关闭一个div。
  • 这是由于没有关闭正确的 div 而产生的。据我所知没有别的

标签: php html css


【解决方案1】:

尝试从包含页脚语句中删除 div 包装器。您在页脚结束 html 标记之外有 div 的结束标记。这可能会有所帮助

【讨论】:

    【解决方案2】:

    您是否也尝试为iframe 设置高度?

    【讨论】:

    • 请。也发布footer.php的内容
    猜你喜欢
    • 1970-01-01
    • 2015-04-03
    • 1970-01-01
    • 2013-07-05
    • 1970-01-01
    • 2016-11-06
    • 2011-08-17
    • 1970-01-01
    相关资源
    最近更新 更多