我对 css 有点陌生,我正在做的很多事情都是被复制或用谷歌搜索的,所以我对它是可怕的错误的前景感到完全不寒而栗。让我告诉你我想要做什么:
我有一个 php 论坛脚本(我的小论坛),我想将它插入到带有页眉、页脚和内容的标准 css 假帧类型包装器中。现在论坛软件使用 smarty 模板引擎,所以我正在编辑 tpl 文件本身。我知道这一切都很好,因为我没有问题让我在 Dreamweaver 中生成的包装器工作。它是手工完成的,这给我带来了麻烦。
现在我可以使用dreamweaver 来制作我的css 框架集,但是它很懒,我想知道它为什么不能在Firefox、Chrome 和Safari 中运行。我确定它只是语法。
首先,您可以在 IE9 中访问我的网站并看到它按设计工作:由于流量而删除了 url - 谢谢!
我将论坛脚本放置在一个 990px 的包装器中,使用单独的页眉、内容和页脚包装器位于论坛索引页面的主要 smarty 主题模板中。看起来不错。不用担心。
现在,如果您在 Chrome、Firefox 或 Safari 中尝试相同的站点,您会看到页眉和页脚存在并按预期工作,但“内容”只是以 100% 的页面宽度加载并忽略绝对定位的 css 样式表设置。
这是我的CSS:
/***************STRUCTURE***************************/
* { margin: 0; padding: 0px; }
/* Absolute positioned header for all browsers*/
#header-wrapper {
position:absolute;
top:0;
left:0;
width:100%;
height:6em;
}
/* Resets the header position to fixed for real browsers such as Firefox*/
body>div#header-wrapper {
position:fixed;
}
#headercustom {
height:6em;
width:990px;
margin:0 auto;
}
#content-wrapper {
padding:6em 0 0 0;
margin-left:0;
margin-top:0;
voice-family: "\"}\"";
voice-family:inherit;
margin-left:16px;
padding-bottom:60px;
}
body>#content-wrapper {
margin-left:0;
}
#contentcustom {
width:990px;
margin:0 auto;
}
#footer-wrapper {
width:100%;
position:absolute;
bottom:0;
left:0;
height:60px;
}
body>#footer-wrapper {
position:fixed;
}
#footercustom {
width:990px;
height:60px;
margin:0 auto;
}
/***************STYLE***************************/
#headercustom,
#footercustom {
background:#fff;
color:#000;
}
这是标记:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="content-wrapper">
<div id="contentcustom">
content ie forum main script in here
</div>
</div>
<div id="header-wrapper">
<div id="headercustom">
Header content here
</div>
</div>
<div id="footer-wrapper">
<div id="footercustom">
Footer content here
</div>
</div>
</body>
</html>
注意:标记被切碎并适当地放置在 smarty 模板中,此处显示仅供参考。它必须工作正常,因为它在 IE 中看起来不错,所以我很确定这是我遇到的 css 语法问题。作为新手并且不知道浏览器如何解释这些事情之间的差异。
你能给我的任何帮助来理解为什么我的定位在 Chrome、FF 和 Safari 中被忽略,但在 IE 中却没有。:D