怎么解决搜狗兼容模式与position':'fixed属性兼容问题
答案:1 悬赏:10
解决时间 2021-04-21 15:13
- 提问者网友:放荡不羁
- 2021-04-21 01:52
我做了一个滚动条下移,导航栏一直在页面顶部的功能,在高速模式下可以实现,但是兼容模式下就不对了,求大神指教
最佳答案
- 二级知识专家网友:情窦初殇
- 2021-04-21 03:04
下面是代码
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>position: fixed——webjx.com</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
#content {
height: 5000px;
width: 50%;
border-right: 10px dotted red;
}
#demo_t, #demo_b, #demo_l, #demo_r {
background: #f90;
position: fixed;
}
#demo_t, #demo_b {
left: 0;
width: 100%;
}
#demo_l, #demo_r {
width: 50px;
top: 300px;
}
#demo_t {
top: 0;
}
#demo_b {
bottom: 0;
}
#demo_l {
left: 0;
}
#demo_r {
right: 0;
}
</style>
<!--[if lte IE 6]>
<style type="text/css">
html {
background: url(about:black) no-repeat fixed
}
#demo_t, #demo_b, #demo_l, #demo_r {
position: absolute;
}
#demo_t, #demo_b {
width: expression(offsetParent.clientWidth);
}
#demo_l, #demo_r {
top: expre...下面是代码
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>position: fixed——webjx.com</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
#content {
height: 5000px;
width: 50%;
border-right: 10px dotted red;
}
#demo_t, #demo_b, #demo_l, #demo_r {
background: #f90;
position: fixed;
}
#demo_t, #demo_b {
left: 0;
width: 100%;
}
#demo_l, #demo_r {
width: 50px;
top: 300px;
}
#demo_t {
top: 0;
}
#demo_b {
bottom: 0;
}
#demo_l {
left: 0;
}
#demo_r {
right: 0;
}
</style>
<!--[if lte IE 6]>
<style type="text/css">
html {
background: url(about:black) no-repeat fixed
}
#demo_t, #demo_b, #demo_l, #demo_r {
position: absolute;
}
#demo_t, #demo_b {
width: expression(offsetParent.clientWidth);
}
#demo_l, #demo_r {
top: expression(offsetParent.scrollTop + 300);
}
#demo_t {
top: expression(offsetParent.scrollTop);
}
#demo_b {
top: expression(offsetParent.scrollTop + offsetParent.clientHeight-offsetHeight);
}
</style>
<![endif]-->
</head>
<body>
<div id="demo_t">此处显示 id "demo" 的内容</div>
<div id="demo_b">此处显示 id "demo" 的内容</div>
<div id="demo_l">此处显示 id "demo" 的内容</div>
<div id="demo_r">此处显示 id "demo" 的内容</div>
<div id="content"></div>
</body>
</html>
建议在实际使用时,将IE条件注释中的代码放在单独的css文件中,以便节约其他浏览器的流量。
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>position: fixed——webjx.com</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
#content {
height: 5000px;
width: 50%;
border-right: 10px dotted red;
}
#demo_t, #demo_b, #demo_l, #demo_r {
background: #f90;
position: fixed;
}
#demo_t, #demo_b {
left: 0;
width: 100%;
}
#demo_l, #demo_r {
width: 50px;
top: 300px;
}
#demo_t {
top: 0;
}
#demo_b {
bottom: 0;
}
#demo_l {
left: 0;
}
#demo_r {
right: 0;
}
</style>
<!--[if lte IE 6]>
<style type="text/css">
html {
background: url(about:black) no-repeat fixed
}
#demo_t, #demo_b, #demo_l, #demo_r {
position: absolute;
}
#demo_t, #demo_b {
width: expression(offsetParent.clientWidth);
}
#demo_l, #demo_r {
top: expre...下面是代码
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>position: fixed——webjx.com</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
#content {
height: 5000px;
width: 50%;
border-right: 10px dotted red;
}
#demo_t, #demo_b, #demo_l, #demo_r {
background: #f90;
position: fixed;
}
#demo_t, #demo_b {
left: 0;
width: 100%;
}
#demo_l, #demo_r {
width: 50px;
top: 300px;
}
#demo_t {
top: 0;
}
#demo_b {
bottom: 0;
}
#demo_l {
left: 0;
}
#demo_r {
right: 0;
}
</style>
<!--[if lte IE 6]>
<style type="text/css">
html {
background: url(about:black) no-repeat fixed
}
#demo_t, #demo_b, #demo_l, #demo_r {
position: absolute;
}
#demo_t, #demo_b {
width: expression(offsetParent.clientWidth);
}
#demo_l, #demo_r {
top: expression(offsetParent.scrollTop + 300);
}
#demo_t {
top: expression(offsetParent.scrollTop);
}
#demo_b {
top: expression(offsetParent.scrollTop + offsetParent.clientHeight-offsetHeight);
}
</style>
<![endif]-->
</head>
<body>
<div id="demo_t">此处显示 id "demo" 的内容</div>
<div id="demo_b">此处显示 id "demo" 的内容</div>
<div id="demo_l">此处显示 id "demo" 的内容</div>
<div id="demo_r">此处显示 id "demo" 的内容</div>
<div id="content"></div>
</body>
</html>
建议在实际使用时,将IE条件注释中的代码放在单独的css文件中,以便节约其他浏览器的流量。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯