有两个绝对定位的 div 标签。关键是要防止第一个在窗口调整大小时超过右侧的窗口,使其小于总宽度。ps:这只发生在firefox中。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My HTML File</title>
<style>
body{
direction: rtl;
}
#sidebar{
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 300px;
min-height: 1000px;
background-color: #66ccff;
}
#content{
position: absolute;
top: 0;
right: 300px;
bottom: 0;
left: 0;
min-width: 1100px;
background-color: #008844;
}
</style>
</head>
<body>
<div id="sidebar"></div>
<div id="content">
</div>
</body>
</html>