IE6中CSS位置问题
我有一些带有页眉、页脚、左侧菜单窗格和内容的 CSS 代码。该布局适用于除 IE6 之外的所有浏览器。在 IE6 中,linksPanel div 在 masterContent div 中无法正确呈现。我认为这与位置元素有关。我看过很多文章,但未能找到有效的解决方案。不幸的是我必须支持 IE6 并且需要一个解决方案。代码如下。任何帮助将非常感激!
<!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 runat="server">
<title></title>
<style type="text/css">
.masterContent
{
position:fixed;
top:178px;
bottom:42px;
left:0px;
right:0px;
overflow:auto;
background:#fff;
}
.linksPanel
{
position:absolute;
top:0px;
left:10px;
bottom:0px;
width:254px;
overflow:auto;
background:#f4f4f3;
line-height:20px;
padding:5px;
}
.mainPanel
{
position:absolute;
top:5px;
bottom:0px;
right:10px;
width:70%;
overflow:auto;
padding-left:10px;
padding-bottom:0px;
}
.footerPanel
{
position:absolute;
bottom:0px;
left:0px;
padding:0px;
margin:0px;
width:100%;
height:44px;
text-align:right;
overflow:hidden;
background:#f4f4f3;
z-index:100;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<div class="headerPanel">
<p>Header stuff here.</p>
<p>More header stuff here.</p>
</div>
</td>
</tr>
</table>
<div class="masterContent">
<div class="linksPanel">
<p><a href="error.aspx">Link1</a></p>
<p><a href="error.aspx">Link2</a></p>
<p><a href="error.aspx">Link3</a></p>
<p><a href="error.aspx">Link4</a></p>
<p><a href="error.aspx">Link5</a></p>
<p><a href="error.aspx">Link6</a></p>
<p><a href="error.aspx">Link7</a></p>
<p><a href="error.aspx">Link8</a></p>
<p><a href="error.aspx">Link9</a></p>
<p><a href="error.aspx">Link10</a></p>
<p><a href="error.aspx">Link11</a></p>
<p><a href="error.aspx">Link12</a></p>
<p><a href="error.aspx">Link1</a></p>
<p><a href="error.aspx">Link2</a></p>
<p><a href="error.aspx">Link3</a></p>
<p><a href="error.aspx">Link4</a></p>
<p><a href="error.aspx">Link5</a></p>
<p><a href="error.aspx">Link6</a></p>
<p><a href="error.aspx">Link7</a></p>
<p><a href="error.aspx">Link8</a></p>
<p><a href="error.aspx">Link9</a></p>
<p><a href="error.aspx">Link10</a></p>
<p><a href="error.aspx">Link11</a></p>
<p><a href="error.aspx">Link12</a></p>
</div>
<div class="mainPanel">
<p>test content</p>
<p>test more content</p>
<p>test</p>
<p>test</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
</div>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="footerPanel">
<p>Footer stuff here.</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
I have some CSS code with a header, footer, left menu pane, and content. The layout is working on all browsers except IE6. In IE6 the linksPanel div does not render correctly within the masterContent div. I believe it has something to do with the position element. I've looked at a bunch of articles but have not been able to find a solution that works. Unfortunately I have to support IE6 and need a solution. Code is below. Any help would be greatly appreciated!
<!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 runat="server">
<title></title>
<style type="text/css">
.masterContent
{
position:fixed;
top:178px;
bottom:42px;
left:0px;
right:0px;
overflow:auto;
background:#fff;
}
.linksPanel
{
position:absolute;
top:0px;
left:10px;
bottom:0px;
width:254px;
overflow:auto;
background:#f4f4f3;
line-height:20px;
padding:5px;
}
.mainPanel
{
position:absolute;
top:5px;
bottom:0px;
right:10px;
width:70%;
overflow:auto;
padding-left:10px;
padding-bottom:0px;
}
.footerPanel
{
position:absolute;
bottom:0px;
left:0px;
padding:0px;
margin:0px;
width:100%;
height:44px;
text-align:right;
overflow:hidden;
background:#f4f4f3;
z-index:100;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<div class="headerPanel">
<p>Header stuff here.</p>
<p>More header stuff here.</p>
</div>
</td>
</tr>
</table>
<div class="masterContent">
<div class="linksPanel">
<p><a href="error.aspx">Link1</a></p>
<p><a href="error.aspx">Link2</a></p>
<p><a href="error.aspx">Link3</a></p>
<p><a href="error.aspx">Link4</a></p>
<p><a href="error.aspx">Link5</a></p>
<p><a href="error.aspx">Link6</a></p>
<p><a href="error.aspx">Link7</a></p>
<p><a href="error.aspx">Link8</a></p>
<p><a href="error.aspx">Link9</a></p>
<p><a href="error.aspx">Link10</a></p>
<p><a href="error.aspx">Link11</a></p>
<p><a href="error.aspx">Link12</a></p>
<p><a href="error.aspx">Link1</a></p>
<p><a href="error.aspx">Link2</a></p>
<p><a href="error.aspx">Link3</a></p>
<p><a href="error.aspx">Link4</a></p>
<p><a href="error.aspx">Link5</a></p>
<p><a href="error.aspx">Link6</a></p>
<p><a href="error.aspx">Link7</a></p>
<p><a href="error.aspx">Link8</a></p>
<p><a href="error.aspx">Link9</a></p>
<p><a href="error.aspx">Link10</a></p>
<p><a href="error.aspx">Link11</a></p>
<p><a href="error.aspx">Link12</a></p>
</div>
<div class="mainPanel">
<p>test content</p>
<p>test more content</p>
<p>test</p>
<p>test</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
</div>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="footerPanel">
<p>Footer stuff here.</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个非常奇怪的设计,我确实见过一些奇怪的设计。
我想,要么你完全误解了 CSS 定位和布局,要么我完全没能理解它。也许这就是您正在寻找的。
使用以下 CSS
基本上你需要一个标题,后面是左侧的 linkspanel,它应该有一个滚动条,然后是一个 mainPanel,它也应该有一个滚动条,它必须位于 linksPanle 的右侧,最后是一个 fotter 。
This is a very strange design and I have seen some strange designs indeed.
<form>
element and by everything, I mean everything including the header, div#masterContent and footer.I think, either you have totally missunderstood CSS Positioning and Layouts, or I have utterly failed to understand it. Maybe this is what you are looking for.
With the following CSS
Basically you want a header, followed by a linkspanel on the left which should have a scroolbar, followed by a mainPanel which should also have a scroolbar and it has to be to the right of the linksPanle and lastly followed by a fotter.