IE7/IE8兼容渲染浮动布局错误
我有一个带有右侧边栏和左侧主要内容区域的网站。代码如下所示:
<div class="leftside">leftsidecontent</div>
<div class="leftside">leftsidecontent</div>
<div class="leftside">leftsidecontent</div>
<div class="leftside">leftsidecontent</div>
<div class="rightside">rightsidecontent</div>
<div class="rightside">rightsidecontent</div>
<div class="rightside">rightsidecontent</div>
with
.leftside
{
float:left;
width:710px;
}
.rightside
{
margin-left:720px;
}
(请参阅实际站点 http://blog.stephenkiers.com/)
原因它是这样编码的,因为左侧内容很重要,我想成为视障访问者访问的第一个数据;而不是他们每次都必须跳过所有的绒毛!
该代码适用于 FF、IE8、Safari 等;但在 IE7 中,右侧 div 会清除浮动 div。
我很乐意接受您的任何建议。我对如何解决这个问题有一些想法;但它们都涉及相当大的重写。
谢谢!
I have a site with a right sidebar and a left main content area. Code looks like this:
<div class="leftside">leftsidecontent</div>
<div class="leftside">leftsidecontent</div>
<div class="leftside">leftsidecontent</div>
<div class="leftside">leftsidecontent</div>
<div class="rightside">rightsidecontent</div>
<div class="rightside">rightsidecontent</div>
<div class="rightside">rightsidecontent</div>
with
.leftside
{
float:left;
width:710px;
}
.rightside
{
margin-left:720px;
}
(see actual site at http://blog.stephenkiers.com/)
Reason it is coded this way is so that because the leftsidecontent is important and I want to be first data accessed by visually impaired visitors; instead of them having to skip all the fluff every time!
The code works in FF, IE8, Safari etc; but in IE7 the rightside divs clear the floated divs.
I would love any suggestions you may have. I have some ideas about how to fix it; but they all involve pretty big rewrites.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不尝试将内容包装成两列,如下所示 示例
CSS:
HTML:
这样,左侧和右侧只是布局元素,与内容隔离。
对于视障访问者来说,另一个好建议是在页面顶部添加链接,让用户可以直接跳到内容部分,并使用 css 将其隐藏在布局中:
why don't you try wrapping the content stuff into two columns like this example
The CSS:
The HTML:
This way the leftside and rightside are just layout elements and are isolated from the content.
Another good tip for visually impaired visitors is to have links at the top of the page to allow users to skip directly to content sections and hide them from your layout with css: