我是php和html脚本的新手,所以我想知道是否有人能给我一个关于如何设置页面结构的建议。
我需要创建一个有页眉和页脚的页面,一个左侧页面菜单和一个显示网站内容的主要部分。
我想到了这样一个框架集:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//IT” “http://www.w3.org/TR/html4/frameset.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1?>
<title>Framesets</title>
</head>
<frameset rows=”20%,70%,10%”>
<frame src=header.php>
<frameset cols=”20%,80%”>
<frame src=menu.php>
<frame src=main.php>
</frameset>
<frame src=footer.php>
</frameset>
<noframes></noframes>
</html>
当有人点击menu.php部分上显示的链接时,只有main.php部分会被调用不同的选项(或者我可以调用不同的php页面,每个选项一个),但我不确定这是最好的解决方案,有人能给我一些建议吗?
(对不起我的英语!)
不,这不好。
HTML框架集的使用已被弃用,并且在最新版本的HTML中不再有效。
如果你需要这种功能,你仍然可以使用<iframe>
,但总的来说,你想要做的是一种非常过时的网页编写方式。
您真的不需要框架,对于这种页面布局,不妨试试这样的东西:
http://jsfiddle.net/YAxQM/
HTML
<header>
<?php include('header.php') ?>
</header>
<div class="main">
<nav>
<?php include('menu.php') ?>
</nav>
<div class="content">
<?php include('main.php') ?>
</div>
</div>
<footer>
<?php include('footer.php') ?>
</footer>
CSS
html, body{
height: 100%;
}
header{
height: 20%;
}
.main{
height: 70%;
}
footer{
height: 10%;
}
nav{
width: 20%;
height: 100%;
float: left;
}