怎样用div+css来统一所有页面的页眉与页脚

发布网友 发布时间:2022-03-25 16:58

我来回答

3个回答

热心网友 时间:2022-03-25 18:28

比如css文件里设置了

.top{
    position:absolute;
    top:0px;
    width:940px;
    height:40px;
    background-color:#c0c0c0;
}
.bottom{
    position:absolute;
    bottom:0px;
    width:940px;
    height:40px;
    background-color:#0c0c0c;
}

呢么在页面代码中首先在head引用一下该css,比如名字为demo.css

<link href="demo.css" rel="stylesheet" type="text/css" /><!--假设页面和css文件在一个目录-->

然后在页面的top使用div

<div class="top">Something</div>

在页面的bottom使用div

<div class="bottom">Something</div>

热心网友 时间:2022-03-25 19:46

php中使用include()函数就行,比如页眉文件为headpage.php,我们用include("headpage.php")就行了

热心网友 时间:2022-03-25 21:20

您应该对div/css不熟悉,只要所有页面的页眉页脚div结构相同,那么调用相同的CSS文件就可以做到了

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com