我的应用程序有一个非常简单的布局。页眉、主要内容和页脚。从语义上讲,它们是这样呈现的:
<body>
<div id = "header"> </div>
<div id = "content"> </div>
<div id = "footer"> </div>
</body>
相应的 CSS 也非常基础:
#header{
width:100%;
min-height:10%;
}
#center{
width:100%;
min-height:80%;
}
#footer{
width:100%;
min-height:10%:
}
如您所知,在布局页面中,内容是如何呈现的:
<div id= "content">
<?php echo $sf_content; ?>
</div>
以上所有内容都非常好,并且按预期呈现。但是这有一个小故障,我输入 <?php echo $sf_content; ?>
的那一刻页脚作为内容的一部分包含在内,而不是作为 #content 标记之后的 div。
基本上,我明白了:
<div id = "header"></div>
<div id = "content>
<div id ="symfony_template_to_be_rendered">
<!-- all web application related content like forms etc. -->
</div>
<div id = "footer">Footer material
</div>
</div>
如您所见,出于某种奇怪的原因,页脚随着 symfony 内容一起向上移动。显然这是一个小故障,因为如果我从我的布局中的 div 标签中删除 php 散列 $sf_content 部分,那么页脚会按照应有的位置呈现自己,并且所有内容都会占用所需的尺寸。
这是怎么回事?
最佳答案
我的愚蠢问题。这是一个非常微不足道的问题,我没有关闭我的一个模板中的 HTML 标签,这无意中弄乱了我的页脚。这个问题的答案:请在发布诸如此类的问题之前正确关闭 HTML 标签 :)
关于html - Symfony 1.4 布局页脚故障 : Footer div is echoed out with $sf_content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13547311/