分辨率不同时,怎样使页面都居中显示

wangsir7013 2008-03-18 08:58:24

用框架(Frame)将浏览器窗口划分为3个窗格。怎样使这样的页面在不同分辨率下都左右居中显示?页面代码如下,请赐教。

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>欢迎登录XX系统</title>
</head>
<frameset rows="113,380" cols="*" framespacing="0" frameborder="0" border="0" >
<frame src="TopTitle.jsp" name="TopFrame" />
<frameset rows="*" cols="151,841" framespacing="0" frameborder="0" border="0" >
<frame src="Menu.jsp" name="MenuFrame" Scrolling ="No"/>
<frame src="blank.jsp" name="ContentFrame" />
</frameset>
</frameset>
...全文
648 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangsir7013 2008-03-18
  • 打赏
  • 举报
回复
luxu,贴的什么。

问题解决了,分享一下:
简单的说就是frameset嵌套
<frameset cols="*,1024,*" border="0px" frameborder="0" framespacing="0px" Scralling="No">

<frame src="blank.jsp" scrolling="no" >

<frameset ...>

<frame src="blank.jsp" scrolling="no" >
这样他就总是能在中间1024像素内显示。
fly0252 2008-03-18
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 rainbowliuliang 的回复:]
CSS

body{
text-align:center;
}
[/Quote]

这是文本居.

页面居中使用margin:0px auto;
Atai-Lu 2008-03-18
  • 打赏
  • 举报
回复
<html>
<head>
<title>-------</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
.style2 {color: #FFFFFF;}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.cell {
float:left;
clear:right;
}
.navPoint {
color: white;
cursor: hand;
font-family: Webdings;
width:10px;
font-size: 12px;
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
<script>
function switchSysBar(){
if (document.getElementById("frmTitle").style.display=="block"){
document.getElementById("switchPoint").innerText=4;
document.getElementById("frmTitle").style.display="none";
}
else{
document.getElementById("switchPoint").innerText=3;
document.getElementById("frmTitle").style.display="block";
}
}
</script>
<body>
<table border="0" cellPadding="0" cellSpacing="0" style="height: 100%" width="100%">
<tr>
<td>
<iframe frameBorder="0" id="frmTitle" name="frmTitle" src="leftmenu.aspx" style="height: 100%; visibility: inherit; width: 192px; z-index: 2; display:block" scrolling="auto"></iframe>
</td>
<td style="width:12px;">
<table style="height: 100%" border="0" cellPadding="0" cellSpacing="0" bgcolor="#CCCCCC">
<tr>
<td style="height: 100%" onClick="switchSysBar()"><font style="FONT-SIZE: 9pt; CURSOR: default; COLOR: #ffffff">
<br>
<span class="navPoint" id="switchPoint" title="关闭/打开左栏">3</span>
<br>
</font></td>
</tr>
</table>
</td>
<td style="WIDTH: 100%">
<iframe frameBorder="0" id="main" name="main" scrolling="yes" src="rightmain.aspx" style="height: 100%; visibility: inherit; width: 100%; z-index: 1;"></iframe></td>
</tr>
</table>
</body>
</html>
wangsir7013 2008-03-18
  • 打赏
  • 举报
回复
可能是我没说清楚。

我所要居中的页面不是一个普通的页面,而是用框架(Frame)将浏览器窗口划分为3个窗格的页面合体(本页面包含另外3个完整的页面)。

所以,页面中没有rainbowliuliang 所说的body(有的只是frame和frameset),也不能通过margin:auto来设置居中。
wangsir7013 2008-03-18
  • 打赏
  • 举报
回复
普通页面通过设置margin:auto来居中,我这也没问题

but,我所说的是通过几个页面拼凑的,通过frame,frameset框架设置的页面。
rainbowliuliang 2008-03-18
  • 打赏
  • 举报
回复
CSS

body{
text-align:center;
}
Atai-Lu 2008-03-18
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScriptLab</title>
<style type="text/css">
<!--
body{margin-left:0px;margin-top:10px;margin-right:0px;margin-bottom:10px;}
<!--我是通过设置标签的margin-left、margin-right来居中的-->
#div{margin-left:auto;margin-right:auto;width:76%;}
#pbody{border:#88cee9 1px solid;padding:15px;}
-->
</style></head>
<body>
<div id="div">
<div id="pbody">
<br/>我这里测试没问题...<br/><br/><br/>
</div>
</div>
</body>
</html>
wangsir7013 2008-03-18
  • 打赏
  • 举报
回复
to luxuoo1207:你的方法对frame不好使
to mShopping :使用百分比,页面中的图片等变形。

mShopping 2008-03-18
  • 打赏
  • 举报
回复
rows 与cols使用百分比.
Atai-Lu 2008-03-18
  • 打赏
  • 举报
回复
被嵌入的页面设置居中

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧