2011-12-30 51 views
1

我为我的网站索引创建了一个顶部栏和一个底部栏。我已经在两个文件中隔离了两个文件,header.php,它控制顶部栏和footer.php,它控制底部栏。包括footer.php和header.php

在索引中没有问题,但是如果我创建了一个像about.php这样的新页面,并且包含了两个php文件,那么顶部和底部的栏会向右移动10px(或类似的东西) 。

在这种情况下,页面较大,因为在两个小节的开始之前在左侧有一个小小的空白区域。

这里有两个文件:

的header.php

<style> 
.blue { background-color: #039; width: 100%; height: 15%; position: absolute; top: 0px; } 
html, body { width: 650px; background-color:#F5F5F5;} 
</style> 

<div class="blue"> 
    <h1 style="text-align: center; color:#FFFFCC ;font-family:"Times New Roman",Times,serif;">My Website</h1> 
</div> 

Footer.php

<ul id="figo"> 
    <li><a href="#home">Home</a></li> 
    <li><a href="#news">News</a></li> 
    <li><a href="#contact">Contact</a></li> 
    <li><a href="#about">About</a></li> 
</ul> 


<style> 
#figo {background-color: #039; position:absolute; bottom:0px; width:100%;} 
ul{ 
    list-style-type:none; 
    margin:0; 
    padding:0; 
    overflow:hidden; 
} 

li{ 
    float:right; 
} 

a{ 
    display:block; 
    width:90px; 
    color:#FFFFCC; 

} 
</style> 

的index.php 我在这里发布的index.php

-

​​
+0

只是一个观察的页面,你应该加上'型=“text/css”'您的'