拖动滚动条时某一处相对另一处固定不动(position:fixed)

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
</head>
<body>
	<div style="float:left;height:100px;100%;border:1px solid;text-align:center;">
		<div style="position:fixed;top:20px;left:20px;100%;border:1px solid; float:left">
			这个是固定的DIV
		</div>
	</div>
	<div style="float:left;height:300px;2000px;border:1px solid; ">
		This tall div is absolutely positioned 500 pixels from the top and 60
		pixels from the left of its containing block.
	</div>
</body>
</html>

  

原文地址:https://www.cnblogs.com/henuyuxiang/p/6155067.html